Skip to content

Commit 5d600f1

Browse files
runtime: re-work fd_hashes
1 parent c30ea13 commit 5d600f1

28 files changed

+1387
-2013
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e4b2e1d169cb5ce1fe12175783804d95584ce592
1+
36b61931456ceaaa8f755fe070e5d1c70a835a2d

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "../../../util/pod/fd_pod_format.h"
2525
#include "../../../discof/replay/fd_replay_notif.h"
2626
#include "../../../discof/repair/fd_fec_chainer.h"
27+
#include "../../../flamenco/runtime/fd_runtime_public.h" /* FD_RUNTIME_PUBLIC_ACCOUNT_UPDATE_MSG_MTU */
2728
#include "../main.h"
2829

2930
#include <unistd.h> /* pause */
@@ -202,6 +203,19 @@ backtest_topo( config_t * config ) {
202203
FOR(writer_tile_cnt) for( ulong j=0UL; j<exec_tile_cnt; j++ )
203204
fd_topob_tile_in( topo, "writer", i, "metric_in", "exec_writer", j, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
204205

206+
/**********************************************************************/
207+
/* Setup writer->replay links in topo, to send solcap account updates
208+
so that they are serialized.
209+
210+
TODO: remove this when solcap v2 is here. */
211+
/**********************************************************************/
212+
if( strlen( config->capture.solcap_capture ) ) {
213+
fd_topob_wksp( topo, "writ_repl" );
214+
FOR(writer_tile_cnt) fd_topob_link( topo, "writ_repl", "writ_repl", 1UL, FD_RUNTIME_PUBLIC_ACCOUNT_UPDATE_MSG_FOOTPRINT, 1UL );
215+
FOR(writer_tile_cnt) fd_topob_tile_out( topo, "writer", i, "writ_repl", i );
216+
FOR(writer_tile_cnt) fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "writ_repl", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
217+
}
218+
205219
/**********************************************************************/
206220
/* Setup the shared objs used by replay and exec tiles */
207221
/**********************************************************************/

src/app/firedancer/topology.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,15 @@ fd_topo_initialize( config_t * config ) {
806806
/**/ fd_topob_tile_in( topo, "plugin", 0UL, "metric_in", "votes_plugin", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
807807
}
808808

809+
/* Link from writer tile to replay tile, to send solcap account updates so that they are serialized.
810+
TODO: remove this when solcap v2 is here. */
811+
if( strlen( config->capture.solcap_capture ) ) {
812+
fd_topob_wksp( topo, "writ_repl" );
813+
FOR(writer_tile_cnt) fd_topob_link( topo, "writ_repl", "writ_repl", 1UL, FD_RUNTIME_PUBLIC_ACCOUNT_UPDATE_MSG_FOOTPRINT, 1UL );
814+
FOR(writer_tile_cnt) fd_topob_tile_out( topo, "writer", i, "writ_repl", i );
815+
FOR(writer_tile_cnt) fd_topob_tile_in( topo, "replay", 0UL, "metric_in", "writ_repl", i, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
816+
}
817+
809818
if( FD_LIKELY( config->tiles.gui.enabled ) ) {
810819
fd_topob_wksp( topo, "gui" );
811820
/**/ fd_topob_tile( topo, "gui", "gui", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 1 );
@@ -1026,6 +1035,8 @@ fd_topo_configure_tile( fd_topo_tile_t * tile,
10261035
tile->exec.dump_syscall_to_pb = config->capture.dump_syscall_to_pb;
10271036
} else if( FD_UNLIKELY( !strcmp( tile->name, "writer" ) ) ) {
10281037
tile->writer.funk_obj_id = fd_pod_query_ulong( config->topo.props, "funk", ULONG_MAX );
1038+
strncpy( tile->writer.solcap_capture, config->capture.solcap_capture, sizeof(tile->writer.solcap_capture) );
1039+
tile->writer.capture_start_slot = config->capture.capture_start_slot;
10291040
} else if( FD_UNLIKELY( !strcmp( tile->name, "snaprd" ) ) ) {
10301041
setup_snapshots( config, tile );
10311042
} else if( FD_UNLIKELY( !strcmp( tile->name, "snapdc" ) ) ) {

src/disco/topo/fd_topo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,8 @@ struct fd_topo_tile {
352352

353353
struct {
354354
ulong funk_obj_id;
355+
char solcap_capture[ PATH_MAX ];
356+
ulong capture_start_slot;
355357
} writer;
356358

357359
struct {

src/discof/exec/fd_exec_tile.c

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "../../flamenco/runtime/fd_runtime.h"
77
#include "../../flamenco/runtime/fd_runtime_public.h"
88
#include "../../flamenco/runtime/fd_executor.h"
9-
#include "../../flamenco/runtime/fd_hashes.h"
109

1110
#include "../../funk/fd_funk.h"
1211

@@ -187,64 +186,6 @@ execute_txn( fd_exec_tile_ctx_t * ctx ) {
187186
} FD_SPAD_FRAME_END;
188187
}
189188

190-
// TODO: hashing can be moved into the writer tile
191-
static void
192-
hash_accounts( fd_exec_tile_ctx_t * ctx,
193-
fd_runtime_public_hash_bank_msg_t * msg ) {
194-
195-
ctx->slot = msg->slot;
196-
fd_funk_txn_map_t * txn_map = fd_funk_txn_map( ctx->funk );
197-
if( FD_UNLIKELY( !txn_map->map ) ) {
198-
FD_LOG_ERR(( "Could not find valid funk transaction map" ));
199-
}
200-
fd_funk_txn_xid_t xid = { .ul = { ctx->slot, ctx->slot } };
201-
fd_funk_txn_start_read( ctx->funk );
202-
fd_funk_txn_t * funk_txn = fd_funk_txn_query( &xid, txn_map );
203-
if( FD_UNLIKELY( !funk_txn ) ) {
204-
FD_LOG_ERR(( "Could not find valid funk transaction" ));
205-
}
206-
fd_funk_txn_end_read( ctx->funk );
207-
ctx->txn_ctx->funk_txn = funk_txn;
208-
209-
fd_banks_lock( ctx->banks );
210-
211-
ctx->bank = fd_banks_get_bank( ctx->banks, ctx->slot );
212-
if( FD_UNLIKELY( !ctx->bank ) ) {
213-
FD_LOG_ERR(( "Could not get bank for slot %lu", ctx->slot ));
214-
}
215-
216-
ctx->txn_ctx->bank = ctx->bank;
217-
ctx->txn_ctx->slot = fd_bank_slot_get( ctx->bank );
218-
219-
ulong start_idx = msg->start_idx;
220-
ulong end_idx = msg->end_idx;
221-
222-
fd_accounts_hash_task_info_t * task_info = fd_wksp_laddr_fast( ctx->runtime_public_wksp, msg->task_infos_gaddr );
223-
if( FD_UNLIKELY( !task_info ) ) {
224-
FD_LOG_ERR(( "Unable to join task info array" ));
225-
}
226-
227-
if( FD_UNLIKELY( !msg->lthash_gaddr ) ) {
228-
FD_LOG_ERR(( "lthash gaddr is zero" ));
229-
}
230-
fd_lthash_value_t * lthash = fd_wksp_laddr_fast( ctx->runtime_public_wksp, msg->lthash_gaddr );
231-
if( FD_UNLIKELY( !lthash ) ) {
232-
FD_LOG_ERR(( "Unable to join lthash" ));
233-
}
234-
fd_lthash_zero( lthash );
235-
236-
for( ulong i=start_idx; i<=end_idx; i++ ) {
237-
fd_account_hash( ctx->txn_ctx->funk,
238-
ctx->txn_ctx->funk_txn,
239-
&task_info[i],
240-
lthash,
241-
ctx->txn_ctx->slot,
242-
&ctx->txn_ctx->features );
243-
}
244-
245-
fd_banks_unlock( ctx->banks );
246-
}
247-
248189
static void
249190
during_frag( fd_exec_tile_ctx_t * ctx,
250191
ulong in_idx,
@@ -269,11 +210,6 @@ during_frag( fd_exec_tile_ctx_t * ctx,
269210
ctx->slot = txn->slot;
270211
execute_txn( ctx );
271212
return;
272-
} else if( sig==EXEC_HASH_ACCS_SIG ) {
273-
fd_runtime_public_hash_bank_msg_t * msg = fd_chunk_to_laddr( ctx->replay_in_mem, chunk );
274-
FD_LOG_DEBUG(( "hash accs=%lu msg recvd", msg->end_idx - msg->start_idx ));
275-
hash_accounts( ctx, msg );
276-
return;
277213
} else {
278214
FD_LOG_CRIT(( "Unknown signature" ));
279215
}
@@ -321,9 +257,6 @@ after_frag( fd_exec_tile_ctx_t * ctx,
321257
if( FD_UNLIKELY( ctx->txn_id==FD_EXEC_ID_SENTINEL ) ) {
322258
ctx->txn_id = 0U;
323259
}
324-
} else if( sig==EXEC_HASH_ACCS_SIG ) {
325-
FD_LOG_DEBUG(( "Sending ack for hash accs msg" ));
326-
fd_fseq_update( ctx->exec_fseq, fd_exec_fseq_set_hash_done( ctx->slot ) );
327260
} else {
328261
FD_LOG_ERR(( "Unknown message signature" ));
329262
}

0 commit comments

Comments
 (0)