Skip to content

Commit 41aa696

Browse files
sender: landing UDP votes
whaa
1 parent 903a3e9 commit 41aa696

File tree

19 files changed

+374
-357
lines changed

19 files changed

+374
-357
lines changed

book/api/metrics-generated.md

+8
Original file line numberDiff line numberDiff line change
@@ -584,3 +584,11 @@
584584
| repair_​sent_​pkt_​types_​needed_​window | `counter` | What types of client messages are we sending (Need Window) |
585585
| repair_​sent_​pkt_​types_​needed_​highest_​window | `counter` | What types of client messages are we sending (Need Highest Window) |
586586
| repair_​sent_​pkt_​types_​needed_​orphan | `counter` | What types of client messages are we sending (Need Orphans) |
587+
588+
## Sender Tile
589+
| Metric | Type | Description |
590+
|--------|------|-------------|
591+
| sender_​txns_​sent_​to_​leader | `counter` | Total count of transactions sent to leader |
592+
| sender_​leader_​sched_​not_​found | `counter` | Total count of times leader schedule not found |
593+
| sender_​leader_​not_​found | `counter` | Total count of times leader not found for given slot |
594+
| sender_​leader_​contact_​not_​found | `counter` | Total count of times leader contact info not found |

src/app/firedancer-dev/commands/backtest.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -280,20 +280,20 @@ backtest_topo( config_t * config ) {
280280
/* Setup replay->stake/sender/poh links in topo w/o consumers */
281281
/**********************************************************************/
282282
fd_topob_wksp( topo, "stake_out" );
283-
fd_topob_wksp( topo, "replay_voter" );
283+
fd_topob_wksp( topo, "replay_send" );
284284
fd_topob_wksp( topo, "replay_poh" );
285285

286-
fd_topob_link( topo, "stake_out", "stake_out", 128UL, 40UL + 40200UL * 40UL, 1UL );
287-
fd_topob_link( topo, "replay_voter", "replay_voter", 128UL, sizeof(fd_txn_p_t), 1UL );
286+
fd_topob_link( topo, "stake_out", "stake_out", 128UL, 40UL + 40200UL * 40UL, 1UL );
287+
fd_topob_link( topo, "replay_send", "replay_send", 128UL, sizeof(fd_txn_p_t), 1UL );
288288
ulong bank_tile_cnt = config->layout.bank_tile_count;
289289
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 );
290290

291-
fd_topob_tile_out( topo, "replay", 0UL, "stake_out", 0UL );
292-
fd_topob_tile_out( topo, "replay", 0UL, "replay_voter", 0UL );
291+
fd_topob_tile_out( topo, "replay", 0UL, "stake_out", 0UL );
292+
fd_topob_tile_out( topo, "replay", 0UL, "replay_send", 0UL );
293293
FOR(bank_tile_cnt) fd_topob_tile_out( topo, "replay", 0UL, "replay_poh", i );
294294

295-
topo->links[ replay_tile->out_link_id[ fd_topo_find_tile_out_link( topo, replay_tile, "stake_out", 0 ) ] ].permit_no_consumers = 1;
296-
topo->links[ replay_tile->out_link_id[ fd_topo_find_tile_out_link( topo, replay_tile, "replay_voter", 0 ) ] ].permit_no_consumers = 1;
295+
topo->links[ replay_tile->out_link_id[ fd_topo_find_tile_out_link( topo, replay_tile, "stake_out", 0 ) ] ].permit_no_consumers = 1;
296+
topo->links[ replay_tile->out_link_id[ fd_topo_find_tile_out_link( topo, replay_tile, "replay_send", 0 ) ] ].permit_no_consumers = 1;
297297
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;
298298

299299
/**********************************************************************/

src/app/firedancer-dev/config/default.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
prometheus_listen_address = "0.0.0.0"
3333
prometheus_listen_port = 7999
3434
[consensus]
35-
vote = false
35+
vote = true
3636
expected_shred_version = 64475
3737
[paths]
3838
identity_key = "{keys}/fd-identity-keypair.json"

src/app/firedancer-dev/config/private.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
prometheus_listen_address = "0.0.0.0"
2727
prometheus_listen_port = 7999
2828
[consensus]
29-
vote = false
29+
vote = true
3030
expected_shred_version = 27972
3131
[paths]
3232
identity_key = "{keys}/fd-identity-keypair.json"

src/app/firedancer/topology.c

+52-55
Large diffs are not rendered by default.

src/disco/dedup/fd_dedup_tile.c

+5-8
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
them out. */
1818

1919
#define IN_KIND_GOSSIP (0UL)
20-
#define IN_KIND_VOTER (1UL)
21-
#define IN_KIND_VERIFY (2UL)
20+
#define IN_KIND_VERIFY (1UL)
2221

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

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

119118
fd_txn_m_t * txnm = (fd_txn_m_t *)dst;
120119
txnm->payload_sz = (ushort)sz;
@@ -161,7 +160,7 @@ after_frag( fd_dedup_ctx_t * ctx,
161160
return;
162161
}
163162

164-
if( FD_UNLIKELY( ctx->in_kind[ in_idx ]==IN_KIND_GOSSIP || ctx->in_kind[ in_idx]==IN_KIND_VOTER ) ) {
163+
if( FD_UNLIKELY( ctx->in_kind[ in_idx ]==IN_KIND_GOSSIP ) ) {
165164
/* Transactions coming in from these links are not parsed.
166165
167166
We'll need to parse it so it's ready for downstream consumers.
@@ -170,7 +169,7 @@ after_frag( fd_dedup_ctx_t * ctx,
170169
txnm->txn_t_sz = (ushort)fd_txn_parse( fd_txn_m_payload( txnm ), txnm->payload_sz, txn, NULL );
171170
if( FD_UNLIKELY( !txnm->txn_t_sz ) ) FD_LOG_ERR(( "fd_txn_parse failed for vote transactions that should have been sigverified" ));
172171

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

176175
int is_dup = 0;
@@ -251,8 +250,6 @@ unprivileged_init( fd_topo_t * topo,
251250

252251
if( !strcmp( link->name, "gossip_dedup" ) ) {
253252
ctx->in_kind[ i ] = IN_KIND_GOSSIP;
254-
} else if( !strcmp( link->name, "voter_dedup" ) ) {
255-
ctx->in_kind[ i ] = IN_KIND_VOTER;
256253
} else if( !strcmp( link->name, "verify_dedup" ) ) {
257254
ctx->in_kind[ i ] = IN_KIND_VERIFY;
258255
} else {

src/disco/metrics/generate/types.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class Tile(Enum):
2525
GOSSIP = 19
2626
NETLNK = 20
2727
SOCK = 21,
28-
REPAIR = 22
28+
REPAIR = 22,
29+
SENDER = 23
2930

3031
class MetricType(Enum):
3132
COUNTER = 0

src/disco/metrics/generated/fd_metrics_all.c

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const char * FD_METRICS_TILE_KIND_NAMES[FD_METRICS_TILE_KIND_CNT] = {
5353
"netlnk",
5454
"sock",
5555
"repair",
56+
"sender",
5657
};
5758

5859
const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT] = {
@@ -73,6 +74,7 @@ const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT] = {
7374
FD_METRICS_NETLNK_TOTAL,
7475
FD_METRICS_SOCK_TOTAL,
7576
FD_METRICS_REPAIR_TOTAL,
77+
FD_METRICS_SENDER_TOTAL,
7678
};
7779
const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT] = {
7880
FD_METRICS_NET,
@@ -92,4 +94,5 @@ const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT]
9294
FD_METRICS_NETLNK,
9395
FD_METRICS_SOCK,
9496
FD_METRICS_REPAIR,
97+
FD_METRICS_SENDER,
9598
};

src/disco/metrics/generated/fd_metrics_all.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "fd_metrics_net.h"
66
#include "fd_metrics_sock.h"
77
#include "fd_metrics_quic.h"
8+
#include "fd_metrics_sender.h"
89
#include "fd_metrics_bundle.h"
910
#include "fd_metrics_verify.h"
1011
#include "fd_metrics_dedup.h"
@@ -155,7 +156,7 @@ extern const fd_metrics_meta_t FD_METRICS_ALL_LINK_OUT[FD_METRICS_ALL_LINK_OUT_T
155156

156157
#define FD_METRICS_TOTAL_SZ (8UL*246UL)
157158

158-
#define FD_METRICS_TILE_KIND_CNT 17
159+
#define FD_METRICS_TILE_KIND_CNT 18
159160
extern const char * FD_METRICS_TILE_KIND_NAMES[FD_METRICS_TILE_KIND_CNT];
160161
extern const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT];
161162
extern const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* THIS FILE IS GENERATED BY gen_metrics.py. DO NOT HAND EDIT. */
2+
#include "fd_metrics_sender.h"
3+
4+
const fd_metrics_meta_t FD_METRICS_SENDER[FD_METRICS_SENDER_TOTAL] = {
5+
DECLARE_METRIC( SENDER_TXNS_SENT_TO_LEADER, COUNTER ),
6+
DECLARE_METRIC( SENDER_LEADER_SCHED_NOT_FOUND, COUNTER ),
7+
DECLARE_METRIC( SENDER_LEADER_NOT_FOUND, COUNTER ),
8+
DECLARE_METRIC( SENDER_LEADER_CONTACT_NOT_FOUND, COUNTER ),
9+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* THIS FILE IS GENERATED BY gen_metrics.py. DO NOT HAND EDIT. */
2+
3+
#include "../fd_metrics_base.h"
4+
#include "fd_metrics_enums.h"
5+
6+
#define FD_METRICS_COUNTER_SENDER_TXNS_SENT_TO_LEADER_OFF (16UL)
7+
#define FD_METRICS_COUNTER_SENDER_TXNS_SENT_TO_LEADER_NAME "sender_txns_sent_to_leader"
8+
#define FD_METRICS_COUNTER_SENDER_TXNS_SENT_TO_LEADER_TYPE (FD_METRICS_TYPE_COUNTER)
9+
#define FD_METRICS_COUNTER_SENDER_TXNS_SENT_TO_LEADER_DESC "Total count of transactions sent to leader"
10+
#define FD_METRICS_COUNTER_SENDER_TXNS_SENT_TO_LEADER_CVT (FD_METRICS_CONVERTER_NONE)
11+
12+
#define FD_METRICS_COUNTER_SENDER_LEADER_SCHED_NOT_FOUND_OFF (17UL)
13+
#define FD_METRICS_COUNTER_SENDER_LEADER_SCHED_NOT_FOUND_NAME "sender_leader_sched_not_found"
14+
#define FD_METRICS_COUNTER_SENDER_LEADER_SCHED_NOT_FOUND_TYPE (FD_METRICS_TYPE_COUNTER)
15+
#define FD_METRICS_COUNTER_SENDER_LEADER_SCHED_NOT_FOUND_DESC "Total count of times leader schedule not found"
16+
#define FD_METRICS_COUNTER_SENDER_LEADER_SCHED_NOT_FOUND_CVT (FD_METRICS_CONVERTER_NONE)
17+
18+
#define FD_METRICS_COUNTER_SENDER_LEADER_NOT_FOUND_OFF (18UL)
19+
#define FD_METRICS_COUNTER_SENDER_LEADER_NOT_FOUND_NAME "sender_leader_not_found"
20+
#define FD_METRICS_COUNTER_SENDER_LEADER_NOT_FOUND_TYPE (FD_METRICS_TYPE_COUNTER)
21+
#define FD_METRICS_COUNTER_SENDER_LEADER_NOT_FOUND_DESC "Total count of times leader not found for given slot"
22+
#define FD_METRICS_COUNTER_SENDER_LEADER_NOT_FOUND_CVT (FD_METRICS_CONVERTER_NONE)
23+
24+
#define FD_METRICS_COUNTER_SENDER_LEADER_CONTACT_NOT_FOUND_OFF (19UL)
25+
#define FD_METRICS_COUNTER_SENDER_LEADER_CONTACT_NOT_FOUND_NAME "sender_leader_contact_not_found"
26+
#define FD_METRICS_COUNTER_SENDER_LEADER_CONTACT_NOT_FOUND_TYPE (FD_METRICS_TYPE_COUNTER)
27+
#define FD_METRICS_COUNTER_SENDER_LEADER_CONTACT_NOT_FOUND_DESC "Total count of times leader contact info not found"
28+
#define FD_METRICS_COUNTER_SENDER_LEADER_CONTACT_NOT_FOUND_CVT (FD_METRICS_CONVERTER_NONE)
29+
30+
#define FD_METRICS_SENDER_TOTAL (4UL)
31+
extern const fd_metrics_meta_t FD_METRICS_SENDER[FD_METRICS_SENDER_TOTAL];

src/disco/metrics/metrics.xml

+7
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ metric introduced.
210210
<counter name="PktRetransmissions" summary="Number of QUIC packets that retransmitted." />
211211
</tile>
212212

213+
<tile name="sender">
214+
<counter name="TxnsSentToLeader" summary="Total count of transactions sent to leader" />
215+
<counter name="LeaderSchedNotFound" summary="Total count of times leader schedule not found" />
216+
<counter name="LeaderNotFound" summary="Total count of times leader not found for given slot" />
217+
<counter name="LeaderContactNotFound" summary="Total count of times leader contact info not found" />
218+
</tile>
219+
213220
<tile name="bundle">
214221
<counter name="TransactionReceived" summary="Total count of transactions received, including transactions within bundles" />
215222
<counter name="PacketReceived" summary="Total count of packets received" />

src/disco/sign/fd_sign_tile.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ unprivileged_init_sensitive( fd_topo_t * topo,
279279
FD_TEST( !strcmp( out_link->name, "sign_repair" ) );
280280
FD_TEST( in_link->mtu==2048UL );
281281
FD_TEST( out_link->mtu==64UL );
282-
} else if ( !strcmp(in_link->name, "voter_sign" ) ) {
282+
} else if ( !strcmp(in_link->name, "send_sign" ) ) {
283283
ctx->in_role[ i ] = FD_KEYGUARD_ROLE_VOTER;
284-
FD_TEST( !strcmp( out_link->name, "sign_voter" ) );
284+
FD_TEST( !strcmp( out_link->name, "sign_send" ) );
285285
FD_TEST( in_link->mtu==FD_TXN_MTU );
286286
FD_TEST( out_link->mtu==64UL );
287287
} else if( !strcmp(in_link->name, "bundle_sign" ) ) {

src/disco/verify/fd_verify_tile.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define IN_KIND_QUIC (0UL)
88
#define IN_KIND_BUNDLE (1UL)
99
#define IN_KIND_GOSSIP (2UL)
10-
10+
#define IN_KIND_SENDER (3UL)
1111
/* The verify tile is a wrapper around the mux tile, that also verifies
1212
incoming transaction signatures match the data being signed.
1313
Non-matching transactions are filtered out of the frag stream. */
@@ -69,7 +69,8 @@ during_frag( fd_verify_ctx_t * ctx,
6969
ulong sz,
7070
ulong ctl FD_PARAM_UNUSED ) {
7171

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

@@ -79,7 +80,7 @@ during_frag( fd_verify_ctx_t * ctx,
7980
dst->payload_sz = (ushort)sz;
8081
dst->block_engine.bundle_id = 0UL;
8182
fd_memcpy( fd_txn_m_payload( dst ), src, sz );
82-
} else if( FD_UNLIKELY( ctx->in_kind[ in_idx ]==IN_KIND_BUNDLE ) ) {
83+
} else if( FD_UNLIKELY( in_kind==IN_KIND_BUNDLE ) ) {
8384
if( FD_UNLIKELY( chunk<ctx->in[in_idx].chunk0 || chunk>ctx->in[in_idx].wmark || sz>FD_TPU_RAW_MTU ) )
8485
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 ));
8586

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

src/discof/eqvoc/fd_eqvoc_tile.c

+7-10
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,20 @@ scratch_footprint( fd_topo_tile_t const * tile FD_PARAM_UNUSED ) {
6767
}
6868

6969
static inline void
70-
handle_new_cluster_contact_info( fd_eqvoc_tile_ctx_t * ctx, uchar const * buf, ulong buf_sz ) {
70+
handle_new_cluster_contact_info( fd_eqvoc_tile_ctx_t * ctx,
71+
uchar const * buf,
72+
ulong buf_sz ) {
7173
ulong const * header = (ulong const *)fd_type_pun_const( buf );
7274

73-
ulong dest_cnt = buf_sz;
74-
75-
if( dest_cnt >= MAX_SHRED_DESTS )
76-
FD_LOG_ERR(( "Cluster nodes had %lu destinations, which was more than the max of %lu",
77-
dest_cnt,
78-
MAX_SHRED_DESTS ));
75+
ulong dest_cnt = buf_sz / sizeof(fd_shred_dest_wire_t);
7976

8077
fd_shred_dest_wire_t const * in_dests = fd_type_pun_const( header );
81-
fd_shred_dest_weighted_t * dests = fd_stake_ci_dest_add_init( ctx->stake_ci );
78+
fd_shred_dest_weighted_t * dests = fd_stake_ci_dest_add_init( ctx->stake_ci );
8279

8380
ctx->new_dest_ptr = dests;
8481
ctx->new_dest_cnt = dest_cnt;
8582

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

232-
ctx->contact_in_idx = fd_topo_find_tile_in_link( topo, tile, "gossip_voter", 0 );
229+
ctx->contact_in_idx = fd_topo_find_tile_in_link( topo, tile, "gossip_send", 0 );
233230
FD_TEST( ctx->contact_in_idx != ULONG_MAX );
234231
fd_topo_link_t * contact_in_link = &topo->links[tile->in_link_id[ctx->contact_in_idx]];
235232
ctx->contact_in_mem = topo->workspaces[topo->objs[contact_in_link->dcache_obj_id].wksp_id].wksp;

0 commit comments

Comments
 (0)