Skip to content

Commit 33da4a0

Browse files
committed
Repair & Sign: async repair requests
1 parent fa06266 commit 33da4a0

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/app/firedancer/config/default.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,10 @@ user = ""
689689
shred_tile_count = 1
690690

691691
# How many sign tiles to run. Should be set to 2. This is
692-
# configurable and designed to scale for the repair tile.
692+
# configurable and designed to scale for the repair tile.
693693
# The 0th tile gets used by other tiles for signing messages. While
694694
# the remaining tiles distribute the workload of signing repair
695-
# requests.
695+
# requests.
696696
sign_tile_count = 2
697697

698698
# All memory that will be used in Firedancer is pre-allocated in two

src/disco/shred/fd_shred_tile.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,6 @@ after_frag( fd_shred_ctx_t * ctx,
857857
ulong sz = fd_shred_header_sz( shred->variant );
858858
fd_memcpy( fd_chunk_to_laddr( ctx->repair_out_mem, ctx->repair_out_chunk ), shred, sz );
859859
ulong tspub = fd_frag_meta_ts_comp( fd_tickcount() );
860-
// FD_LOG_INFO(("Published shred %lu %u %u, time: %ld", shred->slot, shred->idx, shred->fec_set_idx, fd_log_wallclock()));
861860
fd_stem_publish( stem, ctx->repair_out_idx, sig, ctx->repair_out_chunk, sz, 0UL, ctx->tsorig, tspub );
862861
ctx->repair_out_chunk = fd_dcache_compact_next( ctx->repair_out_chunk, sz, ctx->repair_out_chunk0, ctx->repair_out_wmark );
863862
}

src/discof/repair/fd_repair_tile.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ struct fd_repair_tile_ctx {
130130

131131
fd_wksp_t * wksp;
132132

133+
fd_stem_context_t * stem;
134+
133135
uchar in_kind[ MAX_IN_LINKS ];
134136
fd_repair_in_ctx_t in_links[ MAX_IN_LINKS ];
135137

@@ -444,7 +446,7 @@ fd_repair_sign_and_send( fd_repair_tile_ctx_t * repair_tile_ctx,
444446
handle_new_cluster_contact_info, we prepay the RTT cost by sending
445447
a placeholder Repair request immediately.
446448
447-
2. ASYNCHRONOUS REQUEST HANDLING
449+
2. ASYNCHRONOUS REQUEST HANDLING
448450
--------------------------------
449451
Used strictly for repair requests. These requests are sent to the
450452
sign tile, and the repair tile continues handling other operations
@@ -533,11 +535,8 @@ fd_repair_send_request_async( fd_repair_tile_ctx_t * ctx,
533535

534536
fd_repair_pending_sign_req_t * pending = fd_repair_pending_sign_req_deque_push_tail_nocopy( ctx->pending_sign_req_deque );
535537

536-
/* Use the unified sign_and_send function in async mode */
537538
fd_repair_sign_and_send( ctx, &protocol, &peer->addr, pending->buf, sizeof(pending->buf), 1, nonce );
538539

539-
/* Since async requests don't complete the buffer with signature,
540-
we need to track the encoded length */
541540
fd_bincode_encode_ctx_t encode_ctx = { .data = pending->buf, .dataend = pending->buf + sizeof(pending->buf) };
542541
if( FD_UNLIKELY( fd_repair_protocol_encode( &protocol, &encode_ctx ) != FD_BINCODE_SUCCESS ) ) {
543542
FD_LOG_CRIT(( "Failed to encode repair message (type %#x)", protocol.discriminant ));
@@ -670,7 +669,7 @@ during_frag( fd_repair_tile_ctx_t * ctx,
670669
fd_memcpy( ctx->buffer, dcache_entry, dcache_entry_sz );
671670
}
672671

673-
static ulong
672+
static ulong FD_FN_UNUSED
674673
fd_repair_send_ping( fd_repair_tile_ctx_t * repair_tile_ctx,
675674
fd_repair_t * glob,
676675
fd_pinged_elem_t * val,
@@ -697,7 +696,7 @@ fd_repair_send_ping( fd_repair_tile_ctx_t * repair_tile_ctx,
697696
return (ulong)((uchar*)ctx.data - buf);
698697
}
699698

700-
static void
699+
static void FD_FN_UNUSED
701700
fd_repair_recv_pong(fd_repair_t * glob, fd_gossip_ping_t const * pong, fd_gossip_peer_addr_t const * from) {
702701
fd_pinged_elem_t * val = fd_pinged_table_query(glob->pinged, from, NULL);
703702
if( val == NULL || !fd_pubkey_eq( &val->id, &pong->from ) )
@@ -747,6 +746,8 @@ after_frag( fd_repair_tile_ctx_t * ctx,
747746

748747
if( FD_UNLIKELY( ctx->skip_frag ) ) return;
749748

749+
ctx->stem = stem;
750+
750751
uint in_kind = ctx->in_kind[ in_idx ];
751752
// FD_LOG_INFO(( "in_idx: %lu, in_kind: %u", in_idx, in_kind ));
752753
if( FD_UNLIKELY( in_kind==IN_KIND_CONTACT ) ) {
@@ -768,7 +769,7 @@ after_frag( fd_repair_tile_ctx_t * ctx,
768769
sign tile will be returned. Since the repair_sign links are
769770
reliable, the incoming sign_repair fragments represent a complete
770771
set of the previously sent outgoing messages. However, with
771-
multiple sign tiles, the responses may not arrive in order. But,
772+
multiple sign tiles, the responses may not arrive in order. But,
772773
we can safely process them sequentially as we encounter them in
773774
the deque. */
774775
while( !fd_repair_pending_sign_req_deque_empty( ctx->pending_sign_req_deque ) ) {
@@ -1195,7 +1196,7 @@ unprivileged_init( fd_topo_t * topo,
11951196

11961197
if( ctx->in_kind[ in_idx ] == IN_KIND_SIGN ) {
11971198
// fd_wksp_t * wksp = fd_wksp_containing( link->dcache );
1198-
// FD_LOG_NOTICE(( "repair tile: link %s[%lu] mem=%p, dcache=%p, wksp=%p, wksp_name=%s, in_idx=%u",
1199+
// FD_LOG_NOTICE(( "repair tile: link %s[%lu] mem=%p, dcache=%p, wksp=%p, wksp_name=%s, in_idx=%u",
11991200
// link->name, link->kind_id,
12001201
// (void*)ctx->in_links[ in_idx ].mem,
12011202
// link->dcache,

src/discof/send/fd_send_tile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "../../disco/topo/fd_topo.h"
33
#include "../../disco/keyguard/fd_keyload.h"
44
#include "../../disco/keyguard/fd_keyguard.h"
5+
#include "../../disco/fd_txn_m_t.h"
56
#include "generated/fd_send_tile_seccomp.h"
67

78

src/util/hist/fd_histf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#include <math.h> /* FIXME: HMMM */
99
#include "../log/fd_log.h"
10-
1110
#if FD_HAS_AVX
1211
#include "../simd/fd_avx.h"
1312
#endif

0 commit comments

Comments
 (0)