Skip to content

Commit 28c34ff

Browse files
fd_ledger: add solcap-start-slot
1 parent 2fafbb9 commit 28c34ff

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/app/ledger/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct fd_ledger_args {
6565
char const * shredcap; /* path to replay using shredcap instead of rocksdb */
6666
int abort_on_mismatch; /* determine if execution should abort on mismatch*/
6767
char const * capture_fpath; /* solcap: path for solcap file to be created */
68+
ulong solcap_start_slot; /* solcap capture start slot */
6869
int capture_txns; /* solcap: determine if transaction results should be captured for solcap*/
6970
char const * checkpt_path; /* path to dump funk wksp checkpoints during execution*/
7071
ulong checkpt_freq; /* how often funk wksp checkpoints will be dumped (defaults to never) */
@@ -679,6 +680,7 @@ fd_ledger_main_setup( fd_ledger_args_t * args ) {
679680
args->capture_ctx = fd_capture_ctx_new( capture_ctx_mem );
680681

681682
args->capture_ctx->checkpt_freq = ULONG_MAX;
683+
args->capture_ctx->solcap_start_slot = args->solcap_start_slot;
682684

683685
if( has_solcap ) {
684686
capture_file = fopen( args->capture_fpath, "w+" );
@@ -1390,6 +1392,7 @@ initial_setup( int argc, char ** argv, fd_ledger_args_t * args ) {
13901392
char const * checkpt = fd_env_strip_cmdline_cstr ( &argc, &argv, "--checkpt", NULL, NULL );
13911393
char const * checkpt_funk = fd_env_strip_cmdline_cstr ( &argc, &argv, "--checkpt-funk", NULL, NULL );
13921394
char const * capture_fpath = fd_env_strip_cmdline_cstr ( &argc, &argv, "--capture-solcap", NULL, NULL );
1395+
ulong solcap_start_slot = fd_env_strip_cmdline_ulong ( &argc, &argv, "--solcap-start-slot", NULL, 0 );
13931396
int capture_txns = fd_env_strip_cmdline_int ( &argc, &argv, "--capture-txns", NULL, 1 );
13941397
char const * checkpt_path = fd_env_strip_cmdline_cstr ( &argc, &argv, "--checkpt-path", NULL, NULL );
13951398
ulong checkpt_freq = fd_env_strip_cmdline_ulong ( &argc, &argv, "--checkpt-freq", NULL, ULONG_MAX );
@@ -1497,6 +1500,7 @@ initial_setup( int argc, char ** argv, fd_ledger_args_t * args ) {
14971500
args->verify_acc_hash = verify_acc_hash;
14981501
args->trash_hash = trash_hash;
14991502
args->capture_fpath = capture_fpath;
1503+
args->solcap_start_slot = solcap_start_slot;
15001504
args->capture_txns = capture_txns;
15011505
args->checkpt_path = checkpt_path;
15021506
args->checkpt_freq = checkpt_freq;

src/flamenco/runtime/context/fd_capture_ctx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ struct __attribute__((aligned(FD_CAPTURE_CTX_ALIGN))) fd_capture_ctx {
1010
ulong magic; /* ==FD_CAPTURE_CTX_MAGIC */
1111

1212
/* Solcap */
13+
ulong solcap_start_slot;
1314
int trace_dirfd;
1415
int trace_mode;
1516
fd_solcap_writer_t * capture;

src/flamenco/runtime/fd_hashes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ fd_hash_bank( fd_exec_slot_ctx_t * slot_ctx,
260260
}
261261
}
262262

263-
if( capture_ctx != NULL && capture_ctx->capture != NULL ) {
263+
if( capture_ctx != NULL && capture_ctx->capture != NULL && slot_ctx->slot_bank.slot>=capture_ctx->solcap_start_slot ) {
264264
fd_solcap_write_bank_preimage(
265265
capture_ctx->capture,
266266
hash->hash,
@@ -543,7 +543,7 @@ fd_update_hash_bank_exec_hash( fd_exec_slot_ctx_t * slot_ctx,
543543
acc_rec->vt->get_rent_epoch( acc_rec ),
544544
acc_rec->vt->get_data_len( acc_rec ) ));
545545

546-
if( capture_ctx != NULL && capture_ctx->capture != NULL ) {
546+
if( capture_ctx != NULL && capture_ctx->capture != NULL && slot_ctx->slot_bank.slot>=capture_ctx->solcap_start_slot ) {
547547
fd_account_meta_t const * acc_meta = fd_funk_get_acc_meta_readonly( slot_ctx->funk,
548548
slot_ctx->funk_txn,
549549
task_info->acc_pubkey,

src/flamenco/runtime/fd_runtime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ fd_runtime_finalize_txn( fd_exec_slot_ctx_t * slot_ctx,
18601860
int exec_txn_err = task_info->exec_res;
18611861

18621862
/* For ledgers that contain txn status, decode and write out for solcap */
1863-
if( capture_ctx != NULL && capture_ctx->capture && capture_ctx->capture_txns ) {
1863+
if( capture_ctx != NULL && capture_ctx->capture && capture_ctx->capture_txns && slot_ctx->slot_bank.slot>=capture_ctx->solcap_start_slot ) {
18641864
fd_runtime_write_transaction_status( capture_ctx, slot_ctx, txn_ctx, exec_txn_err );
18651865
}
18661866
FD_ATOMIC_FETCH_AND_ADD( &slot_ctx->signature_cnt, txn_ctx->txn_descriptor->signature_cnt );
@@ -4080,7 +4080,7 @@ fd_runtime_block_execute_tpool( fd_exec_slot_ctx_t * slot_ctx,
40804080
ulong exec_spad_cnt,
40814081
fd_spad_t * runtime_spad ) {
40824082

4083-
if ( capture_ctx != NULL && capture_ctx->capture ) {
4083+
if ( capture_ctx != NULL && capture_ctx->capture && slot_ctx->slot_bank.slot>=capture_ctx->solcap_start_slot ) {
40844084
fd_solcap_writer_set_slot( capture_ctx->capture, slot_ctx->slot_bank.slot );
40854085
}
40864086

0 commit comments

Comments
 (0)