@@ -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
@@ -424,7 +426,7 @@ fd_repair_sign_and_send( fd_repair_tile_ctx_t * repair_tile_ctx,
424426 }
425427}
426428
427- /* REPAIR TILE REQUEST HANDLING ARCHITECTURE
429+ /* REQUEST HANDLING ARCHITECTURE
428430 =========================================
429431
430432 The repair tile implements two distinct request handling patterns
@@ -440,11 +442,7 @@ fd_repair_sign_and_send( fd_repair_tile_ctx_t * repair_tile_ctx,
440442 - PINGs & PONGs: Handles peer connectivity and liveness with simple
441443 round-trip messages.
442444
443- - PEER WARM UPs: On receiving peer information in
444- handle_new_cluster_contact_info, we prepay the RTT cost by sending
445- a placeholder Repair request immediately.
446-
447- 2. ASYNCHRONOUS REQUEST HANDLING
445+ 2. ASYNCHRONOUS REQUEST HANDLING
448446 --------------------------------
449447 Used strictly for repair requests. These requests are sent to the
450448 sign tile, and the repair tile continues handling other operations
@@ -464,6 +462,10 @@ fd_repair_sign_and_send( fd_repair_tile_ctx_t * repair_tile_ctx,
464462 - ORPHAN: Requests for the highest shred in the parent slot of an
465463 orphaned slot. Used to establish the chain of slot ancestry when a
466464 slot's parent is missing.
465+
466+ - PEER WARM UPs: On receiving peer information in
467+ handle_new_cluster_contact_info, we prepay the RTT cost by sending
468+ a placeholder Repair request immediately.
467469
468470 Async requests can be distributed across multiple sign tiles using
469471 round-robin based on the request nonce. This provides load balancing
@@ -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 ));
@@ -593,12 +592,12 @@ handle_new_cluster_contact_info( fd_repair_tile_ctx_t * ctx,
593592 };
594593 int dup = fd_repair_add_active_peer ( ctx -> repair , & repair_peer , in_dests [i ].pubkey );
595594 if ( !dup ) {
596- /* The repair process uses a Ping-Pong protocol that incurs one
597- round-trip time (RTT) for the initial repair request. To optimize
598- this, we proactively send a placeholder Repair request as soon as we
599- receive a peer's contact information for the first time, effectively
600- prepaying the RTT cost. */
601- fd_repair_send_request (ctx , ctx -> stem , ctx -> repair , 0 , 0 , 0 , in_dests [i ].pubkey , fd_log_wallclock ());
595+ /* The repair process uses a Ping-Pong protocol that incurs one
596+ round-trip time (RTT) for the initial repair request. To optimize
597+ this, we proactively send a placeholder Repair request as soon as we
598+ receive a peer's contact information for the first time, effectively
599+ prepaying the RTT cost. */
600+ fd_repair_send_request_async (ctx , ctx -> stem , ctx -> repair , 0 , 0 , 0 , in_dests [i ].pubkey , fd_log_wallclock ());
602601 ulong hash_src = 0xfffffUL & fd_ulong_hash ( (ulong )in_dests [i ].ip4_addr | ((ulong )repair_peer .port <<32 ) );
603602 FD_LOG_INFO (( "Added repair peer: pubkey %s hash_src %lu" , FD_BASE58_ENC_32_ALLOCA (in_dests [i ].pubkey ), hash_src ));
604603 }
@@ -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
674673fd_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
701700fd_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,
0 commit comments