Skip to content

Sender: Lands UDP votes #5064

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions book/api/metrics-generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -584,3 +584,11 @@
| repair_​sent_​pkt_​types_​needed_​window | `counter` | What types of client messages are we sending (Need Window) |
| repair_​sent_​pkt_​types_​needed_​highest_​window | `counter` | What types of client messages are we sending (Need Highest Window) |
| repair_​sent_​pkt_​types_​needed_​orphan | `counter` | What types of client messages are we sending (Need Orphans) |

## Sender Tile
| Metric | Type | Description |
|--------|------|-------------|
| sender_​txns_​sent_​to_​leader | `counter` | Total count of transactions sent to leader |
| sender_​leader_​sched_​not_​found | `counter` | Total count of times leader schedule not found |
| sender_​leader_​not_​found | `counter` | Total count of times leader not found for given slot |
| sender_​leader_​contact_​not_​found | `counter` | Total count of times leader contact info not found |
14 changes: 7 additions & 7 deletions src/app/firedancer-dev/commands/backtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,20 +280,20 @@ backtest_topo( config_t * config ) {
/* Setup replay->stake/sender/poh links in topo w/o consumers */
/**********************************************************************/
fd_topob_wksp( topo, "stake_out" );
fd_topob_wksp( topo, "replay_voter" );
fd_topob_wksp( topo, "replay_send" );
fd_topob_wksp( topo, "replay_poh" );

fd_topob_link( topo, "stake_out", "stake_out", 128UL, 40UL + 40200UL * 40UL, 1UL );
fd_topob_link( topo, "replay_voter", "replay_voter", 128UL, sizeof(fd_txn_p_t), 1UL );
fd_topob_link( topo, "stake_out", "stake_out", 128UL, 40UL + 40200UL * 40UL, 1UL );
fd_topob_link( topo, "replay_send", "replay_send", 128UL, sizeof(fd_txn_p_t), 1UL );
ulong bank_tile_cnt = config->layout.bank_tile_count;
FOR(bank_tile_cnt) fd_topob_link( topo, "replay_poh", "replay_poh", 128UL, (4096UL*sizeof(fd_txn_p_t))+sizeof(fd_microblock_trailer_t), 1UL );

fd_topob_tile_out( topo, "replay", 0UL, "stake_out", 0UL );
fd_topob_tile_out( topo, "replay", 0UL, "replay_voter", 0UL );
fd_topob_tile_out( topo, "replay", 0UL, "stake_out", 0UL );
fd_topob_tile_out( topo, "replay", 0UL, "replay_send", 0UL );
FOR(bank_tile_cnt) fd_topob_tile_out( topo, "replay", 0UL, "replay_poh", i );

topo->links[ replay_tile->out_link_id[ fd_topo_find_tile_out_link( topo, replay_tile, "stake_out", 0 ) ] ].permit_no_consumers = 1;
topo->links[ replay_tile->out_link_id[ fd_topo_find_tile_out_link( topo, replay_tile, "replay_voter", 0 ) ] ].permit_no_consumers = 1;
topo->links[ replay_tile->out_link_id[ fd_topo_find_tile_out_link( topo, replay_tile, "stake_out", 0 ) ] ].permit_no_consumers = 1;
topo->links[ replay_tile->out_link_id[ fd_topo_find_tile_out_link( topo, replay_tile, "replay_send", 0 ) ] ].permit_no_consumers = 1;
FOR(bank_tile_cnt) topo->links[ replay_tile->out_link_id[ fd_topo_find_tile_out_link( topo, replay_tile, "replay_poh", i ) ] ].permit_no_consumers = 1;

/**********************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/app/firedancer-dev/config/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
prometheus_listen_address = "0.0.0.0"
prometheus_listen_port = 7999
[consensus]
vote = false
vote = true
expected_shred_version = 64475
[paths]
identity_key = "{keys}/fd-identity-keypair.json"
Expand Down
2 changes: 1 addition & 1 deletion src/app/firedancer-dev/config/private.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
prometheus_listen_address = "0.0.0.0"
prometheus_listen_port = 7999
[consensus]
vote = false
vote = true
expected_shred_version = 20896
[paths]
identity_key = "{keys}/fd-identity-keypair.json"
Expand Down
107 changes: 52 additions & 55 deletions src/app/firedancer/topology.c

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions src/disco/dedup/fd_dedup_tile.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
them out. */

#define IN_KIND_GOSSIP (0UL)
#define IN_KIND_VOTER (1UL)
#define IN_KIND_VERIFY (2UL)
#define IN_KIND_VERIFY (1UL)

/* fd_dedup_in_ctx_t is a context object for each in (producer) mcache
connected to the dedup tile. */
Expand Down Expand Up @@ -113,8 +112,8 @@ during_frag( fd_dedup_ctx_t * ctx,
uchar * src = (uchar *)fd_chunk_to_laddr( ctx->in[ in_idx ].mem, chunk );
uchar * dst = (uchar *)fd_chunk_to_laddr( ctx->out_mem, ctx->out_chunk );

if( FD_UNLIKELY( ctx->in_kind[ in_idx ]==IN_KIND_GOSSIP || ctx->in_kind[ in_idx ]==IN_KIND_VOTER ) ) {
if( FD_UNLIKELY( sz>FD_TPU_MTU ) ) FD_LOG_ERR(( "received a gossip or voter transaction that was too large" ));
if( FD_UNLIKELY( ctx->in_kind[ in_idx ]==IN_KIND_GOSSIP ) ) {
if( FD_UNLIKELY( sz>FD_TPU_MTU ) ) FD_LOG_ERR(( "received a gossip transaction that was too large" ));

fd_txn_m_t * txnm = (fd_txn_m_t *)dst;
txnm->payload_sz = (ushort)sz;
Expand Down Expand Up @@ -161,7 +160,7 @@ after_frag( fd_dedup_ctx_t * ctx,
return;
}

if( FD_UNLIKELY( ctx->in_kind[ in_idx ]==IN_KIND_GOSSIP || ctx->in_kind[ in_idx]==IN_KIND_VOTER ) ) {
if( FD_UNLIKELY( ctx->in_kind[ in_idx ]==IN_KIND_GOSSIP ) ) {
/* Transactions coming in from these links are not parsed.

We'll need to parse it so it's ready for downstream consumers.
Expand All @@ -170,7 +169,7 @@ after_frag( fd_dedup_ctx_t * ctx,
txnm->txn_t_sz = (ushort)fd_txn_parse( fd_txn_m_payload( txnm ), txnm->payload_sz, txn, NULL );
if( FD_UNLIKELY( !txnm->txn_t_sz ) ) FD_LOG_ERR(( "fd_txn_parse failed for vote transactions that should have been sigverified" ));

if( FD_UNLIKELY( ctx->in_kind[ in_idx ]==IN_KIND_GOSSIP ) ) FD_MCNT_INC( DEDUP, GOSSIPED_VOTES_RECEIVED, 1UL );
FD_MCNT_INC( DEDUP, GOSSIPED_VOTES_RECEIVED, 1UL );
}

int is_dup = 0;
Expand Down Expand Up @@ -251,8 +250,6 @@ unprivileged_init( fd_topo_t * topo,

if( !strcmp( link->name, "gossip_dedup" ) ) {
ctx->in_kind[ i ] = IN_KIND_GOSSIP;
} else if( !strcmp( link->name, "voter_dedup" ) ) {
ctx->in_kind[ i ] = IN_KIND_VOTER;
} else if( !strcmp( link->name, "verify_dedup" ) ) {
ctx->in_kind[ i ] = IN_KIND_VERIFY;
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/disco/metrics/generate/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class Tile(Enum):
GOSSIP = 19
NETLNK = 20
SOCK = 21,
REPAIR = 22
REPAIR = 22,
SENDER = 23
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
SENDER = 23
SEND = 23,


class MetricType(Enum):
COUNTER = 0
Expand Down
3 changes: 3 additions & 0 deletions src/disco/metrics/generated/fd_metrics_all.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const char * FD_METRICS_TILE_KIND_NAMES[FD_METRICS_TILE_KIND_CNT] = {
"netlnk",
"sock",
"repair",
"sender",
};

const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT] = {
Expand All @@ -73,6 +74,7 @@ const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT] = {
FD_METRICS_NETLNK_TOTAL,
FD_METRICS_SOCK_TOTAL,
FD_METRICS_REPAIR_TOTAL,
FD_METRICS_SENDER_TOTAL,
};
const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT] = {
FD_METRICS_NET,
Expand All @@ -92,4 +94,5 @@ const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT]
FD_METRICS_NETLNK,
FD_METRICS_SOCK,
FD_METRICS_REPAIR,
FD_METRICS_SENDER,
};
3 changes: 2 additions & 1 deletion src/disco/metrics/generated/fd_metrics_all.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "fd_metrics_net.h"
#include "fd_metrics_sock.h"
#include "fd_metrics_quic.h"
#include "fd_metrics_sender.h"
#include "fd_metrics_bundle.h"
#include "fd_metrics_verify.h"
#include "fd_metrics_dedup.h"
Expand Down Expand Up @@ -155,7 +156,7 @@ extern const fd_metrics_meta_t FD_METRICS_ALL_LINK_OUT[FD_METRICS_ALL_LINK_OUT_T

#define FD_METRICS_TOTAL_SZ (8UL*246UL)

#define FD_METRICS_TILE_KIND_CNT 17
#define FD_METRICS_TILE_KIND_CNT 18
extern const char * FD_METRICS_TILE_KIND_NAMES[FD_METRICS_TILE_KIND_CNT];
extern const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT];
extern const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT];
9 changes: 9 additions & 0 deletions src/disco/metrics/generated/fd_metrics_sender.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* THIS FILE IS GENERATED BY gen_metrics.py. DO NOT HAND EDIT. */
#include "fd_metrics_sender.h"

const fd_metrics_meta_t FD_METRICS_SENDER[FD_METRICS_SENDER_TOTAL] = {
DECLARE_METRIC( SENDER_TXNS_SENT_TO_LEADER, COUNTER ),
DECLARE_METRIC( SENDER_LEADER_SCHED_NOT_FOUND, COUNTER ),
DECLARE_METRIC( SENDER_LEADER_NOT_FOUND, COUNTER ),
DECLARE_METRIC( SENDER_LEADER_CONTACT_NOT_FOUND, COUNTER ),
};
31 changes: 31 additions & 0 deletions src/disco/metrics/generated/fd_metrics_sender.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* THIS FILE IS GENERATED BY gen_metrics.py. DO NOT HAND EDIT. */

#include "../fd_metrics_base.h"
#include "fd_metrics_enums.h"

#define FD_METRICS_COUNTER_SENDER_TXNS_SENT_TO_LEADER_OFF (16UL)
#define FD_METRICS_COUNTER_SENDER_TXNS_SENT_TO_LEADER_NAME "sender_txns_sent_to_leader"
#define FD_METRICS_COUNTER_SENDER_TXNS_SENT_TO_LEADER_TYPE (FD_METRICS_TYPE_COUNTER)
#define FD_METRICS_COUNTER_SENDER_TXNS_SENT_TO_LEADER_DESC "Total count of transactions sent to leader"
#define FD_METRICS_COUNTER_SENDER_TXNS_SENT_TO_LEADER_CVT (FD_METRICS_CONVERTER_NONE)

#define FD_METRICS_COUNTER_SENDER_LEADER_SCHED_NOT_FOUND_OFF (17UL)
#define FD_METRICS_COUNTER_SENDER_LEADER_SCHED_NOT_FOUND_NAME "sender_leader_sched_not_found"
#define FD_METRICS_COUNTER_SENDER_LEADER_SCHED_NOT_FOUND_TYPE (FD_METRICS_TYPE_COUNTER)
#define FD_METRICS_COUNTER_SENDER_LEADER_SCHED_NOT_FOUND_DESC "Total count of times leader schedule not found"
#define FD_METRICS_COUNTER_SENDER_LEADER_SCHED_NOT_FOUND_CVT (FD_METRICS_CONVERTER_NONE)

#define FD_METRICS_COUNTER_SENDER_LEADER_NOT_FOUND_OFF (18UL)
#define FD_METRICS_COUNTER_SENDER_LEADER_NOT_FOUND_NAME "sender_leader_not_found"
#define FD_METRICS_COUNTER_SENDER_LEADER_NOT_FOUND_TYPE (FD_METRICS_TYPE_COUNTER)
#define FD_METRICS_COUNTER_SENDER_LEADER_NOT_FOUND_DESC "Total count of times leader not found for given slot"
#define FD_METRICS_COUNTER_SENDER_LEADER_NOT_FOUND_CVT (FD_METRICS_CONVERTER_NONE)

#define FD_METRICS_COUNTER_SENDER_LEADER_CONTACT_NOT_FOUND_OFF (19UL)
#define FD_METRICS_COUNTER_SENDER_LEADER_CONTACT_NOT_FOUND_NAME "sender_leader_contact_not_found"
#define FD_METRICS_COUNTER_SENDER_LEADER_CONTACT_NOT_FOUND_TYPE (FD_METRICS_TYPE_COUNTER)
#define FD_METRICS_COUNTER_SENDER_LEADER_CONTACT_NOT_FOUND_DESC "Total count of times leader contact info not found"
#define FD_METRICS_COUNTER_SENDER_LEADER_CONTACT_NOT_FOUND_CVT (FD_METRICS_CONVERTER_NONE)

#define FD_METRICS_SENDER_TOTAL (4UL)
extern const fd_metrics_meta_t FD_METRICS_SENDER[FD_METRICS_SENDER_TOTAL];
7 changes: 7 additions & 0 deletions src/disco/metrics/metrics.xml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ metric introduced.
<counter name="PktRetransmissions" summary="Number of QUIC packets that retransmitted." />
</tile>

<tile name="sender">
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<tile name="sender">
<tile name="send">

<counter name="TxnsSentToLeader" summary="Total count of transactions sent to leader" />
<counter name="LeaderSchedNotFound" summary="Total count of times leader schedule not found" />
<counter name="LeaderNotFound" summary="Total count of times leader not found for given slot" />
<counter name="LeaderContactNotFound" summary="Total count of times leader contact info not found" />
</tile>

<tile name="bundle">
<counter name="TransactionReceived" summary="Total count of transactions received, including transactions within bundles" />
<counter name="PacketReceived" summary="Total count of packets received" />
Expand Down
4 changes: 2 additions & 2 deletions src/disco/sign/fd_sign_tile.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ unprivileged_init_sensitive( fd_topo_t * topo,
FD_TEST( !strcmp( out_link->name, "sign_repair" ) );
FD_TEST( in_link->mtu==2048UL );
FD_TEST( out_link->mtu==64UL );
} else if ( !strcmp(in_link->name, "voter_sign" ) ) {
} else if ( !strcmp(in_link->name, "send_sign" ) ) {
ctx->in_role[ i ] = FD_KEYGUARD_ROLE_VOTER;
FD_TEST( !strcmp( out_link->name, "sign_voter" ) );
FD_TEST( !strcmp( out_link->name, "sign_send" ) );
FD_TEST( in_link->mtu==FD_TXN_MTU );
FD_TEST( out_link->mtu==64UL );
} else if( !strcmp(in_link->name, "bundle_sign" ) ) {
Expand Down
8 changes: 5 additions & 3 deletions src/disco/verify/fd_verify_tile.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define IN_KIND_QUIC (0UL)
#define IN_KIND_BUNDLE (1UL)
#define IN_KIND_GOSSIP (2UL)

#define IN_KIND_SENDER (3UL)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#define IN_KIND_SENDER (3UL)
#define IN_KIND_SEND (3UL)

/* The verify tile is a wrapper around the mux tile, that also verifies
incoming transaction signatures match the data being signed.
Non-matching transactions are filtered out of the frag stream. */
Expand Down Expand Up @@ -69,7 +69,8 @@ during_frag( fd_verify_ctx_t * ctx,
ulong sz,
ulong ctl FD_PARAM_UNUSED ) {

if( FD_UNLIKELY( ctx->in_kind[ in_idx ]==IN_KIND_QUIC || ctx->in_kind[ in_idx ]==IN_KIND_GOSSIP ) ) {
ulong in_kind = ctx->in_kind[ in_idx ];
if( FD_UNLIKELY( in_kind==IN_KIND_QUIC || in_kind==IN_KIND_GOSSIP || in_kind==IN_KIND_SENDER ) ) {
if( FD_UNLIKELY( chunk<ctx->in[in_idx].chunk0 || chunk>ctx->in[in_idx].wmark || sz>FD_TPU_MTU ) )
FD_LOG_ERR(( "chunk %lu %lu corrupt, not in range [%lu,%lu]", chunk, sz, ctx->in[in_idx].chunk0, ctx->in[in_idx].wmark ));

Expand All @@ -79,7 +80,7 @@ during_frag( fd_verify_ctx_t * ctx,
dst->payload_sz = (ushort)sz;
dst->block_engine.bundle_id = 0UL;
fd_memcpy( fd_txn_m_payload( dst ), src, sz );
} else if( FD_UNLIKELY( ctx->in_kind[ in_idx ]==IN_KIND_BUNDLE ) ) {
} else if( FD_UNLIKELY( in_kind==IN_KIND_BUNDLE ) ) {
if( FD_UNLIKELY( chunk<ctx->in[in_idx].chunk0 || chunk>ctx->in[in_idx].wmark || sz>FD_TPU_RAW_MTU ) )
FD_LOG_ERR(( "chunk %lu %lu corrupt, not in range [%lu,%lu,%lu]", chunk, sz, ctx->in[in_idx].chunk0, ctx->in[in_idx].wmark, FD_TPU_RAW_MTU ));

Expand Down Expand Up @@ -205,6 +206,7 @@ unprivileged_init( fd_topo_t * topo,
if( !strcmp( link->name, "quic_verify" ) ) ctx->in_kind[ i ] = IN_KIND_QUIC;
else if( !strcmp( link->name, "bundle_verif" ) ) ctx->in_kind[ i ] = IN_KIND_BUNDLE;
else if( !strcmp( link->name, "gossip_verif" ) ) ctx->in_kind[ i ] = IN_KIND_GOSSIP;
else if( !strcmp( link->name, "send_txns" ) ) ctx->in_kind[ i ] = IN_KIND_SENDER;
else FD_LOG_ERR(( "unexpected link name %s", link->name ));
}

Expand Down
17 changes: 7 additions & 10 deletions src/discof/eqvoc/fd_eqvoc_tile.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,20 @@ scratch_footprint( fd_topo_tile_t const * tile FD_PARAM_UNUSED ) {
}

static inline void
handle_new_cluster_contact_info( fd_eqvoc_tile_ctx_t * ctx, uchar const * buf, ulong buf_sz ) {
handle_new_cluster_contact_info( fd_eqvoc_tile_ctx_t * ctx,
uchar const * buf,
ulong buf_sz ) {
ulong const * header = (ulong const *)fd_type_pun_const( buf );

ulong dest_cnt = buf_sz;

if( dest_cnt >= MAX_SHRED_DESTS )
FD_LOG_ERR(( "Cluster nodes had %lu destinations, which was more than the max of %lu",
dest_cnt,
MAX_SHRED_DESTS ));
ulong dest_cnt = buf_sz / sizeof(fd_shred_dest_wire_t);

fd_shred_dest_wire_t const * in_dests = fd_type_pun_const( header );
fd_shred_dest_weighted_t * dests = fd_stake_ci_dest_add_init( ctx->stake_ci );
fd_shred_dest_weighted_t * dests = fd_stake_ci_dest_add_init( ctx->stake_ci );

ctx->new_dest_ptr = dests;
ctx->new_dest_cnt = dest_cnt;

for( ulong i = 0UL; i < dest_cnt; i++ ) {
for( ulong i=0UL; i<dest_cnt; i++ ) {
memcpy( dests[i].pubkey.uc, in_dests[i].pubkey, 32UL );
dests[i].ip4 = in_dests[i].ip4_addr;
dests[i].port = in_dests[i].udp_port;
Expand Down Expand Up @@ -229,7 +226,7 @@ unprivileged_init( fd_topo_t * topo,
ctx->stake_ci = fd_stake_ci_join( fd_stake_ci_new( stake_ci_mem, ctx->identity_key ) );
ctx->eqvoc = fd_eqvoc_join( fd_eqvoc_new( eqvoc_mem, 1 << 10, 1 << 10, 0 ) );

ctx->contact_in_idx = fd_topo_find_tile_in_link( topo, tile, "gossip_voter", 0 );
ctx->contact_in_idx = fd_topo_find_tile_in_link( topo, tile, "gossip_send", 0 );
FD_TEST( ctx->contact_in_idx != ULONG_MAX );
fd_topo_link_t * contact_in_link = &topo->links[tile->in_link_id[ctx->contact_in_idx]];
ctx->contact_in_mem = topo->workspaces[topo->objs[contact_in_link->dcache_obj_id].wksp_id].wksp;
Expand Down
Loading
Loading