Skip to content

Commit ff44f30

Browse files
committed
work
1 parent 9c85e63 commit ff44f30

File tree

5 files changed

+37
-3
lines changed

5 files changed

+37
-3
lines changed

src/discof/rpcserver/fd_rpc_history.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ fd_rpc_history_save(fd_rpc_history_t * hist, fd_replay_notif_msg_t * info) {
208208
} FD_SPAD_FRAME_END;
209209
}
210210

211+
void
212+
fd_rpc_history_save_shred(fd_rpc_history_t * hist, fd_shred_t * shred) {
213+
(void)hist;
214+
(void)shred;
215+
}
216+
211217
ulong
212218
fd_rpc_history_first_slot(fd_rpc_history_t * hist) {
213219
return hist->first_slot;

src/discof/rpcserver/fd_rpc_history.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define HEADER_fd_src_discof_rpcserver_fd_rpc_history_h
33

44
#include "fd_rpc_service.h"
5+
#include "../../ballet/shred/fd_shred.h"
56

67
struct fd_rpc_history;
78
typedef struct fd_rpc_history fd_rpc_history_t;
@@ -15,6 +16,8 @@ fd_rpc_history_t * fd_rpc_history_create(fd_rpcserver_args_t * args);
1516

1617
void fd_rpc_history_save(fd_rpc_history_t * hist, fd_replay_notif_msg_t * msg);
1718

19+
void fd_rpc_history_save_shred(fd_rpc_history_t * hist, fd_shred_t * shred);
20+
1821
ulong fd_rpc_history_first_slot(fd_rpc_history_t * hist);
1922

2023
ulong fd_rpc_history_latest_slot(fd_rpc_history_t * hist);

src/discof/rpcserver/fd_rpc_service.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "../../flamenco/runtime/fd_acc_mgr.h"
77
#include "../../ballet/base58/fd_base58.h"
88
#include "../../ballet/base64/fd_base64.h"
9+
#include "../../ballet/shred/fd_shred.h"
910
#include "fd_rpc_history.h"
1011
#include "fd_block_to_json.h"
1112
#include "keywords.h"
@@ -2434,3 +2435,19 @@ fd_rpc_stake_after_frag(fd_rpc_ctx_t * ctx, fd_multi_epoch_leaders_t * state) {
24342435
(void)ctx;
24352436
fd_multi_epoch_leaders_stake_msg_fini( state );
24362437
}
2438+
2439+
void
2440+
fd_rpc_shred_repair_during_frag(fd_rpc_ctx_t * ctx, uchar * shred, void const * msg, int sz) {
2441+
(void)ctx;
2442+
FD_TEST( sz <= (int)FD_SHRED_MAX_SZ );
2443+
fd_memcpy(shred, msg, (ulong)sz);
2444+
}
2445+
2446+
void
2447+
fd_rpc_shred_repair_after_frag(fd_rpc_ctx_t * ctx, uchar * shred) {
2448+
fd_rpc_global_ctx_t * subs = ctx->global;
2449+
fd_shred_t * shred_p = (fd_shred_t *)shred;
2450+
if( fd_shred_is_data( shred_p->variant ) ) {
2451+
fd_rpc_history_save_shred( subs->history, shred_p );
2452+
}
2453+
}

src/discof/rpcserver/fd_rpc_service.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ void fd_rpc_stake_during_frag(fd_rpc_ctx_t * ctx, fd_multi_epoch_leaders_t * sta
4343

4444
void fd_rpc_stake_after_frag(fd_rpc_ctx_t * ctx, fd_multi_epoch_leaders_t * state);
4545

46+
void fd_rpc_shred_repair_during_frag(fd_rpc_ctx_t * ctx, uchar * shred, void const * msg, int sz);
47+
48+
void fd_rpc_shred_repair_after_frag(fd_rpc_ctx_t * ctx, uchar * shred);
49+
4650
#endif /* HEADER_fd_src_discof_rpcserver_fd_rpc_service_h */

src/discof/rpcserver/fd_rpcserv_tile.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
/* Repair tile runs the repair protocol for a Firedancer node. */
22
#define _GNU_SOURCE
33

4-
#include "../../disco/topo/fd_topo.h"
54
#include <sys/socket.h>
65

6+
#include "../../disco/topo/fd_topo.h"
77
#include "generated/fd_rpcserv_tile_seccomp.h"
8-
98
#include "../rpcserver/fd_rpc_service.h"
10-
119
#include "../../flamenco/leaders/fd_multi_epoch_leaders.h"
1210
#include "../../disco/keyguard/fd_keyload.h"
1311
#include "../../disco/keyguard/fd_keyswitch.h"
12+
#include "../../ballet/shred/fd_shred.h"
1413

1514
#include <fcntl.h>
1615
#include <unistd.h>
@@ -39,6 +38,7 @@ struct fd_rpcserv_tile_ctx {
3938
fd_keyswitch_t * keyswitch;
4039

4140
fd_replay_notif_msg_t replay_notif_in_state;
41+
uchar shred_in_state[ FD_SHRED_MAX_SZ ];
4242

4343
uchar in_kind[ MAX_IN_LINKS ];
4444
fd_rpcserv_in_ctx_t in_links[ MAX_IN_LINKS ];
@@ -109,6 +109,8 @@ during_frag( fd_rpcserv_tile_ctx_t * ctx,
109109
fd_rpc_replay_during_frag( ctx->ctx, &ctx->replay_notif_in_state, fd_chunk_to_laddr_const( ctx->in_links[in_idx].mem, chunk ), (int)sz );
110110
} else if( FD_UNLIKELY( kind == IN_KIND_STAKE_OUT ) ) {
111111
fd_rpc_stake_during_frag( ctx->ctx, ctx->args.leaders, fd_chunk_to_laddr_const( ctx->in_links[in_idx].mem, chunk ), (int)sz );
112+
} else if( FD_UNLIKELY( kind == IN_KIND_SHRED_REPAIR ) ) {
113+
fd_rpc_shred_repair_during_frag( ctx->ctx, ctx->shred_in_state, fd_chunk_to_laddr_const( ctx->in_links[in_idx].mem, chunk ), (int)sz );
112114
} else {
113115
FD_LOG_ERR(("Unknown in_idx %lu for rpc", in_idx));
114116
}
@@ -135,6 +137,8 @@ after_frag( fd_rpcserv_tile_ctx_t * ctx,
135137
fd_rpc_replay_after_frag( ctx->ctx, &ctx->replay_notif_in_state );
136138
} else if( FD_UNLIKELY( kind == IN_KIND_STAKE_OUT ) ) {
137139
fd_rpc_stake_after_frag( ctx->ctx, ctx->args.leaders );
140+
} else if( FD_UNLIKELY( kind == IN_KIND_SHRED_REPAIR ) ) {
141+
fd_rpc_shred_repair_after_frag( ctx->ctx, ctx->shred_in_state );
138142
} else {
139143
FD_LOG_ERR(("Unknown in_idx %lu for rpc", in_idx));
140144
}

0 commit comments

Comments
 (0)