Skip to content

Commit 1e08dc1

Browse files
committed
capture, fuzz: split dumping ctx from capture ctx
1 parent a88ec9d commit 1e08dc1

File tree

13 files changed

+178
-159
lines changed

13 files changed

+178
-159
lines changed

src/discof/execrp/fd_execrp_tile.c

Lines changed: 51 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "../../flamenco/runtime/fd_bank.h"
1010
#include "../../flamenco/runtime/fd_runtime.h"
1111
#include "../../flamenco/runtime/fd_acc_pool.h"
12+
#include "../../flamenco/runtime/tests/fd_dump_pb.h"
1213
#include "../../flamenco/progcache/fd_progcache_user.h"
1314
#include "../../flamenco/log_collector/fd_log_collector_base.h"
1415
#include "../../disco/metrics/fd_metrics.h"
@@ -44,6 +45,10 @@ struct fd_execrp_tile {
4445
fd_capture_ctx_t * capture_ctx;
4546
fd_capture_link_buf_t cap_execrp_out[1];
4647

48+
/* Protobuf dumping context for debugging runtime execution and
49+
collecting seed corpora. */
50+
fd_dump_proto_ctx_t * dump_proto_ctx;
51+
4752
/* A transaction can be executed as long as there is a valid handle to
4853
a funk_txn and a bank. These are queried from fd_banks_t and
4954
fd_funk_t. */
@@ -275,11 +280,12 @@ unprivileged_init( fd_topo_t * topo,
275280
void * scratch = fd_topo_obj_laddr( topo, tile->tile_obj_id );
276281

277282
FD_SCRATCH_ALLOC_INIT( l, scratch );
278-
fd_execrp_tile_t * ctx = FD_SCRATCH_ALLOC_APPEND( l, alignof(fd_execrp_tile_t), sizeof(fd_execrp_tile_t) );
279-
void * capture_ctx_mem = FD_SCRATCH_ALLOC_APPEND( l, fd_capture_ctx_align(), fd_capture_ctx_footprint() );
280-
void * _txncache = FD_SCRATCH_ALLOC_APPEND( l, fd_txncache_align(), fd_txncache_footprint( tile->execrp.max_live_slots ) );
281-
uchar * pc_scratch = FD_SCRATCH_ALLOC_APPEND( l, FD_PROGCACHE_SCRATCH_ALIGN, FD_PROGCACHE_SCRATCH_FOOTPRINT );
282-
ulong scratch_alloc_mem = FD_SCRATCH_ALLOC_FINI( l, scratch_align() );
283+
fd_execrp_tile_t * ctx = FD_SCRATCH_ALLOC_APPEND( l, alignof(fd_execrp_tile_t), sizeof(fd_execrp_tile_t) );
284+
void * capture_ctx_mem = FD_SCRATCH_ALLOC_APPEND( l, fd_capture_ctx_align(), fd_capture_ctx_footprint() );
285+
void * dump_proto_ctx_mem = FD_SCRATCH_ALLOC_APPEND( l, alignof(fd_dump_proto_ctx_t), sizeof(fd_dump_proto_ctx_t) );
286+
void * _txncache = FD_SCRATCH_ALLOC_APPEND( l, fd_txncache_align(), fd_txncache_footprint( tile->execrp.max_live_slots ) );
287+
uchar * pc_scratch = FD_SCRATCH_ALLOC_APPEND( l, FD_PROGCACHE_SCRATCH_ALIGN, FD_PROGCACHE_SCRATCH_FOOTPRINT );
288+
ulong scratch_alloc_mem = FD_SCRATCH_ALLOC_FINI( l, scratch_align() );
283289

284290
if( FD_UNLIKELY( scratch_alloc_mem - (ulong)scratch - scratch_footprint( tile ) ) ) {
285291
FD_LOG_ERR( ( "Scratch_alloc_mem did not match scratch_footprint diff: %lu alloc: %lu footprint: %lu",
@@ -375,52 +381,51 @@ unprivileged_init( fd_topo_t * topo,
375381
/********************************************************************/
376382

377383
ctx->capture_ctx = NULL;
378-
379-
if( FD_UNLIKELY( strlen( tile->execrp.solcap_capture ) || strlen( tile->execrp.dump_proto_dir ) ) ) {
384+
if( FD_UNLIKELY( strlen( tile->execrp.solcap_capture ) ) ) {
380385
ctx->capture_ctx = fd_capture_ctx_join( fd_capture_ctx_new( capture_ctx_mem ) );
381386
ctx->capture_ctx->solcap_start_slot = tile->execrp.capture_start_slot;
382387

383-
if( strlen( tile->execrp.solcap_capture ) ) {
384-
ulong tile_idx = tile->kind_id;
385-
ulong idx = fd_topo_find_tile_out_link( topo, tile, "cap_execrp", tile_idx );
386-
FD_TEST( idx!=ULONG_MAX );
387-
fd_topo_link_t * link = &topo->links[ tile->out_link_id[ idx ] ];
388-
fd_capture_link_buf_t * cap_execrp_out = ctx->cap_execrp_out;
389-
cap_execrp_out->base.vt = &fd_capture_link_buf_vt;
390-
cap_execrp_out->idx = idx;
391-
cap_execrp_out->mem = topo->workspaces[ topo->objs[ link->dcache_obj_id ].wksp_id ].wksp;
392-
cap_execrp_out->chunk0 = fd_dcache_compact_chunk0( cap_execrp_out->mem, link->dcache );
393-
cap_execrp_out->wmark = fd_dcache_compact_wmark( cap_execrp_out->mem, link->dcache, link->mtu );
394-
cap_execrp_out->chunk = cap_execrp_out->chunk0;
395-
cap_execrp_out->mcache = link->mcache;
396-
cap_execrp_out->depth = fd_mcache_depth( link->mcache );
397-
cap_execrp_out->seq = 0UL;
398-
399-
ulong consumer_tile_idx = fd_topo_find_tile(topo, "solcap", 0UL);
400-
fd_topo_tile_t * consumer_tile = &topo->tiles[ consumer_tile_idx ];
401-
cap_execrp_out->fseq = NULL;
402-
for( ulong j = 0UL; j < consumer_tile->in_cnt; j++ ) {
403-
if( FD_UNLIKELY( consumer_tile->in_link_id[ j ] == link->id ) ) {
404-
cap_execrp_out->fseq = fd_fseq_join( fd_topo_obj_laddr( topo, consumer_tile->in_link_fseq_obj_id[ j ] ) );
405-
FD_TEST( cap_execrp_out->fseq );
406-
break;
407-
}
388+
ulong tile_idx = tile->kind_id;
389+
ulong idx = fd_topo_find_tile_out_link( topo, tile, "cap_execrp", tile_idx );
390+
FD_TEST( idx!=ULONG_MAX );
391+
fd_topo_link_t * link = &topo->links[ tile->out_link_id[ idx ] ];
392+
fd_capture_link_buf_t * cap_execrp_out = ctx->cap_execrp_out;
393+
cap_execrp_out->base.vt = &fd_capture_link_buf_vt;
394+
cap_execrp_out->idx = idx;
395+
cap_execrp_out->mem = topo->workspaces[ topo->objs[ link->dcache_obj_id ].wksp_id ].wksp;
396+
cap_execrp_out->chunk0 = fd_dcache_compact_chunk0( cap_execrp_out->mem, link->dcache );
397+
cap_execrp_out->wmark = fd_dcache_compact_wmark( cap_execrp_out->mem, link->dcache, link->mtu );
398+
cap_execrp_out->chunk = cap_execrp_out->chunk0;
399+
cap_execrp_out->mcache = link->mcache;
400+
cap_execrp_out->depth = fd_mcache_depth( link->mcache );
401+
cap_execrp_out->seq = 0UL;
402+
403+
ulong consumer_tile_idx = fd_topo_find_tile(topo, "solcap", 0UL);
404+
fd_topo_tile_t * consumer_tile = &topo->tiles[ consumer_tile_idx ];
405+
cap_execrp_out->fseq = NULL;
406+
for( ulong j = 0UL; j < consumer_tile->in_cnt; j++ ) {
407+
if( FD_UNLIKELY( consumer_tile->in_link_id[ j ] == link->id ) ) {
408+
cap_execrp_out->fseq = fd_fseq_join( fd_topo_obj_laddr( topo, consumer_tile->in_link_fseq_obj_id[ j ] ) );
409+
FD_TEST( cap_execrp_out->fseq );
410+
break;
408411
}
409-
410-
ctx->capture_ctx->capture_solcap = 1;
411-
ctx->capture_ctx->capctx_type.buf = cap_execrp_out;
412-
ctx->capture_ctx->capture_link = &cap_execrp_out->base;
413412
}
414413

415-
if( strlen( tile->execrp.dump_proto_dir ) ) {
416-
ctx->capture_ctx->dump_proto_output_dir = tile->execrp.dump_proto_dir;
417-
ctx->capture_ctx->dump_proto_start_slot = tile->execrp.capture_start_slot;
418-
ctx->capture_ctx->dump_syscall_name_filter = tile->execrp.dump_syscall_name_filter;
419-
ctx->capture_ctx->dump_instr_to_pb = tile->execrp.dump_instr_to_pb;
420-
ctx->capture_ctx->dump_txn_to_pb = tile->execrp.dump_txn_to_pb;
421-
ctx->capture_ctx->dump_syscall_to_pb = tile->execrp.dump_syscall_to_pb;
422-
ctx->capture_ctx->dump_elf_to_pb = tile->execrp.dump_elf_to_pb;
423-
}
414+
ctx->capture_ctx->capture_solcap = 1;
415+
ctx->capture_ctx->capctx_type.buf = cap_execrp_out;
416+
ctx->capture_ctx->capture_link = &cap_execrp_out->base;
417+
}
418+
419+
ctx->dump_proto_ctx = NULL;
420+
if( FD_UNLIKELY( strlen( tile->execrp.dump_proto_dir ) ) ) {
421+
ctx->dump_proto_ctx = dump_proto_ctx_mem;
422+
ctx->dump_proto_ctx->dump_proto_output_dir = tile->execrp.dump_proto_dir;
423+
ctx->dump_proto_ctx->dump_proto_start_slot = tile->execrp.capture_start_slot;
424+
ctx->dump_proto_ctx->dump_syscall_name_filter = tile->execrp.dump_syscall_name_filter;
425+
ctx->dump_proto_ctx->dump_instr_to_pb = !!tile->execrp.dump_instr_to_pb;
426+
ctx->dump_proto_ctx->dump_txn_to_pb = !!tile->execrp.dump_txn_to_pb;
427+
ctx->dump_proto_ctx->dump_syscall_to_pb = !!tile->execrp.dump_syscall_to_pb;
428+
ctx->dump_proto_ctx->dump_elf_to_pb = !!tile->execrp.dump_elf_to_pb;
424429
}
425430

426431
/********************************************************************/
@@ -437,6 +442,7 @@ unprivileged_init( fd_topo_t * topo,
437442
ctx->runtime->log.enable_vm_tracing = 0;
438443
ctx->runtime->log.tracing_mem = &ctx->tracing_mem[0][0];
439444
ctx->runtime->log.capture_ctx = ctx->capture_ctx;
445+
ctx->runtime->log.dump_proto_ctx = ctx->dump_proto_ctx;
440446

441447
memset( &ctx->metrics, 0, sizeof(ctx->metrics) );
442448
memset( &ctx->runtime->metrics, 0, sizeof(ctx->runtime->metrics) );

src/discof/replay/fd_replay_tile.c

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ struct fd_replay_tile {
340340
FILE * capture_file;
341341
fd_capture_link_buf_t cap_repl_out[1];
342342

343+
/* Protobuf dumping context for debugging runtime execution and
344+
collecting seed corpora. */
345+
fd_dump_proto_ctx_t * dump_proto_ctx;
346+
343347
/* Whether the runtime has been booted either from snapshot loading
344348
or from genesis. */
345349
int is_booted;
@@ -440,15 +444,16 @@ scratch_footprint( fd_topo_tile_t const * tile ) {
440444
ulong chain_cnt = fd_block_id_map_chain_cnt_est( tile->replay.max_live_slots );
441445

442446
ulong l = FD_LAYOUT_INIT;
443-
l = FD_LAYOUT_APPEND( l, alignof(fd_replay_tile_t), sizeof(fd_replay_tile_t) );
444-
l = FD_LAYOUT_APPEND( l, alignof(fd_block_id_ele_t), sizeof(fd_block_id_ele_t) * tile->replay.max_live_slots );
445-
l = FD_LAYOUT_APPEND( l, fd_block_id_map_align(), fd_block_id_map_footprint( chain_cnt ) );
446-
l = FD_LAYOUT_APPEND( l, fd_txncache_align(), fd_txncache_footprint( tile->replay.max_live_slots ) );
447-
l = FD_LAYOUT_APPEND( l, fd_reasm_align(), fd_reasm_footprint( tile->replay.fec_max ) );
448-
l = FD_LAYOUT_APPEND( l, fd_sched_align(), fd_sched_footprint( tile->replay.max_live_slots ) );
449-
l = FD_LAYOUT_APPEND( l, fd_vinyl_req_pool_align(), fd_vinyl_req_pool_footprint( 1UL, 1UL ) );
450-
l = FD_LAYOUT_APPEND( l, fd_vote_tracker_align(), fd_vote_tracker_footprint() );
451-
l = FD_LAYOUT_APPEND( l, fd_capture_ctx_align(), fd_capture_ctx_footprint() );
447+
l = FD_LAYOUT_APPEND( l, alignof(fd_replay_tile_t), sizeof(fd_replay_tile_t) );
448+
l = FD_LAYOUT_APPEND( l, alignof(fd_block_id_ele_t), sizeof(fd_block_id_ele_t) * tile->replay.max_live_slots );
449+
l = FD_LAYOUT_APPEND( l, fd_block_id_map_align(), fd_block_id_map_footprint( chain_cnt ) );
450+
l = FD_LAYOUT_APPEND( l, fd_txncache_align(), fd_txncache_footprint( tile->replay.max_live_slots ) );
451+
l = FD_LAYOUT_APPEND( l, fd_reasm_align(), fd_reasm_footprint( tile->replay.fec_max ) );
452+
l = FD_LAYOUT_APPEND( l, fd_sched_align(), fd_sched_footprint( tile->replay.max_live_slots ) );
453+
l = FD_LAYOUT_APPEND( l, fd_vinyl_req_pool_align(), fd_vinyl_req_pool_footprint( 1UL, 1UL ) );
454+
l = FD_LAYOUT_APPEND( l, fd_vote_tracker_align(), fd_vote_tracker_footprint() );
455+
l = FD_LAYOUT_APPEND( l, fd_capture_ctx_align(), fd_capture_ctx_footprint() );
456+
l = FD_LAYOUT_APPEND( l, alignof(fd_dump_proto_ctx_t), sizeof(fd_dump_proto_ctx_t) );
452457

453458
# if FD_HAS_FLATCC
454459
if( FD_UNLIKELY( tile->replay.dump_block_to_pb ) ) {
@@ -828,8 +833,8 @@ replay_block_finalize( fd_replay_tile_t * ctx,
828833
# if FD_HAS_FLATCC
829834
/* If enabled, dump the block to a file and reset the dumping
830835
context state */
831-
if( FD_UNLIKELY( ctx->capture_ctx && ctx->capture_ctx->dump_block_to_pb ) ) {
832-
fd_dump_block_to_protobuf( ctx->block_dump_ctx, ctx->banks, bank, ctx->accdb, ctx->capture_ctx );
836+
if( FD_UNLIKELY( ctx->dump_proto_ctx && ctx->dump_proto_ctx->dump_block_to_pb ) ) {
837+
fd_dump_block_to_protobuf( ctx->block_dump_ctx, ctx->banks, bank, ctx->accdb, ctx->dump_proto_ctx );
833838
fd_block_dump_context_reset( ctx->block_dump_ctx );
834839
}
835840
# endif
@@ -1570,7 +1575,7 @@ dispatch_task( fd_replay_tile_t * ctx,
15701575
/* Add the transaction to the block dumper if necessary. This
15711576
logic doesn't need to be fork-aware since it's only meant to
15721577
be used in backtest. */
1573-
if( FD_UNLIKELY( ctx->capture_ctx && ctx->capture_ctx->dump_block_to_pb ) ) {
1578+
if( FD_UNLIKELY( ctx->dump_proto_ctx && ctx->dump_proto_ctx->dump_block_to_pb ) ) {
15741579
fd_dump_block_to_protobuf_collect_tx( ctx->block_dump_ctx, txn_p );
15751580
}
15761581
# endif
@@ -2526,6 +2531,7 @@ unprivileged_init( fd_topo_t * topo,
25262531
void * vinyl_req_pool_mem = FD_SCRATCH_ALLOC_APPEND( l, fd_vinyl_req_pool_align(), fd_vinyl_req_pool_footprint( 1UL, 1UL ) );
25272532
void * vote_tracker_mem = FD_SCRATCH_ALLOC_APPEND( l, fd_vote_tracker_align(), fd_vote_tracker_footprint() );
25282533
void * _capture_ctx = FD_SCRATCH_ALLOC_APPEND( l, fd_capture_ctx_align(), fd_capture_ctx_footprint() );
2534+
void * dump_proto_ctx_mem = FD_SCRATCH_ALLOC_APPEND( l, alignof(fd_dump_proto_ctx_t), sizeof(fd_dump_proto_ctx_t) );
25292535
# if FD_HAS_FLATCC
25302536
void * block_dump_ctx = NULL;
25312537
if( FD_UNLIKELY( tile->replay.dump_block_to_pb ) ) {
@@ -2612,18 +2618,19 @@ unprivileged_init( fd_topo_t * topo,
26122618
FD_TEST( ctx->txncache );
26132619

26142620
ctx->capture_ctx = NULL;
2615-
if( FD_UNLIKELY( strcmp( "", tile->replay.solcap_capture ) || strcmp( "", tile->replay.dump_proto_dir ) ) ) {
2621+
if( FD_UNLIKELY( strcmp( "", tile->replay.solcap_capture ) ) ) {
26162622
ctx->capture_ctx = fd_capture_ctx_join( fd_capture_ctx_new( _capture_ctx ) );
26172623
ctx->capture_ctx->solcap_start_slot = tile->replay.capture_start_slot;
2618-
}
2619-
2620-
if( FD_UNLIKELY( strcmp( "", tile->replay.solcap_capture ) ) ) {
26212624
ctx->capture_ctx->capture_solcap = 1;
26222625
}
26232626

2627+
ctx->dump_proto_ctx = NULL;
26242628
if( FD_UNLIKELY( strcmp( "", tile->replay.dump_proto_dir ) ) ) {
2625-
ctx->capture_ctx->dump_proto_output_dir = tile->replay.dump_proto_dir;
2626-
if( FD_LIKELY( tile->replay.dump_block_to_pb ) ) ctx->capture_ctx->dump_block_to_pb = tile->replay.dump_block_to_pb;
2629+
ctx->dump_proto_ctx = dump_proto_ctx_mem;
2630+
ctx->dump_proto_ctx->dump_proto_output_dir = tile->replay.dump_proto_dir;
2631+
if( FD_LIKELY( tile->replay.dump_block_to_pb ) ) {
2632+
ctx->dump_proto_ctx->dump_block_to_pb = !!tile->replay.dump_block_to_pb;
2633+
}
26272634
}
26282635

26292636
# if FD_HAS_FLATCC

src/flamenco/capture/fd_capture_ctx.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -127,28 +127,6 @@ struct fd_capture_ctx {
127127
fd_solcap_writer_t * capture;
128128

129129
ulong current_txn_idx;
130-
131-
/*======== PROTOBUF ========*/
132-
char const * dump_proto_output_dir;
133-
char const * dump_proto_sig_filter;
134-
ulong dump_proto_start_slot;
135-
136-
/* Instruction Capture */
137-
int dump_instr_to_pb;
138-
139-
/* Transaction Capture */
140-
int dump_txn_to_pb;
141-
142-
/* Block Capture */
143-
int dump_block_to_pb;
144-
145-
/* Syscall Capture */
146-
int dump_syscall_to_pb;
147-
char const * dump_syscall_name_filter;
148-
149-
/* ELF Capture */
150-
int dump_elf_to_pb;
151-
152130
};
153131
typedef struct fd_capture_ctx fd_capture_ctx_t;
154132

src/flamenco/fd_flamenco_base.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ typedef struct fd_acc_mgr fd_acc_mgr_t;
3232
struct fd_capture_ctx;
3333
typedef struct fd_capture_ctx fd_capture_ctx_t;
3434

35+
struct fd_dump_proto_ctx;
36+
typedef struct fd_dump_proto_ctx fd_dump_proto_ctx_t;
37+
3538
struct fd_borrowed_account;
3639
typedef struct fd_borrowed_account fd_borrowed_account_t;
3740

src/flamenco/runtime/fd_executor.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,9 +1580,9 @@ fd_executor_setup_accounts_for_txn( fd_runtime_t * runtime,
15801580

15811581
# if FD_HAS_FLATCC
15821582
/* Dumping ELF files to protobuf, if applicable */
1583-
int dump_elf_to_pb = runtime->log.capture_ctx &&
1584-
fd_bank_slot_get( bank ) >= runtime->log.capture_ctx->dump_proto_start_slot &&
1585-
runtime->log.capture_ctx->dump_elf_to_pb;
1583+
int dump_elf_to_pb = runtime->log.dump_proto_ctx &&
1584+
fd_bank_slot_get( bank )>=runtime->log.dump_proto_ctx->dump_proto_start_slot &&
1585+
runtime->log.dump_proto_ctx->dump_elf_to_pb;
15861586
if( FD_UNLIKELY( dump_elf_to_pb ) ) {
15871587
for( ushort i=0; i<txn_out->accounts.cnt; i++ ) {
15881588
fd_account_meta_t * acc_meta = txn_out->accounts.account[i].meta;
@@ -1683,7 +1683,9 @@ fd_execute_txn( fd_runtime_t * runtime,
16831683
fd_txn_out_t * txn_out ) {
16841684
fd_accdb_user_t * accdb = runtime->accdb;
16851685

1686-
bool dump_insn = runtime->log.capture_ctx && fd_bank_slot_get( bank ) >= runtime->log.capture_ctx->dump_proto_start_slot && runtime->log.capture_ctx->dump_instr_to_pb;
1686+
bool dump_insn = runtime->log.dump_proto_ctx &&
1687+
fd_bank_slot_get( bank )>=runtime->log.dump_proto_ctx->dump_proto_start_slot &&
1688+
runtime->log.dump_proto_ctx->dump_instr_to_pb;
16871689
(void)dump_insn;
16881690

16891691
fd_txn_t const * txn = TXN( txn_in->txn );

src/flamenco/runtime/fd_runtime.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,9 +880,9 @@ fd_runtime_pre_execute_check( fd_runtime_t * runtime,
880880
*/
881881

882882
# if FD_HAS_FLATCC
883-
uchar dump_txn = !!( runtime->log.capture_ctx &&
884-
fd_bank_slot_get( bank ) >= runtime->log.capture_ctx->dump_proto_start_slot &&
885-
runtime->log.capture_ctx->dump_txn_to_pb );
883+
uchar dump_txn = !!( runtime->log.dump_proto_ctx &&
884+
fd_bank_slot_get( bank ) >= runtime->log.dump_proto_ctx->dump_proto_start_slot &&
885+
runtime->log.dump_proto_ctx->dump_txn_to_pb );
886886
if( FD_UNLIKELY( dump_txn ) ) {
887887
fd_dump_txn_to_protobuf( runtime, bank, txn_in, txn_out );
888888
}

src/flamenco/runtime/fd_runtime.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,18 @@ struct fd_runtime {
110110
} accounts;
111111

112112
struct {
113-
int enable_log_collector;
114-
fd_log_collector_t * log_collector; /* Log collector instance */
115-
fd_capture_ctx_t * capture_ctx;
113+
int enable_log_collector;
114+
fd_log_collector_t * log_collector; /* Log collector instance */
115+
fd_capture_ctx_t * capture_ctx;
116+
fd_dump_proto_ctx_t * dump_proto_ctx;
117+
116118
/* Pointer to buffer used for dumping instructions and transactions
117119
into protobuf files. */
118-
uchar * dumping_mem;
120+
uchar * dumping_mem;
119121
/* Pointer to buffer used for tracing instructions and transactions
120122
into protobuf files. */
121-
int enable_vm_tracing;
122-
uchar * tracing_mem;
123+
int enable_vm_tracing;
124+
uchar * tracing_mem;
123125
} log;
124126

125127
struct {

src/flamenco/runtime/program/fd_bpf_loader_program.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "../../../ballet/sbpf/fd_sbpf_loader.h"
66
#include "../../progcache/fd_prog_load.h"
77
#include "../../progcache/fd_progcache_user.h"
8+
#include "../tests/fd_dump_pb.h"
89
#include "../sysvar/fd_sysvar.h"
910
#include "../fd_pubkey_utils.h"
1011
#include "../fd_borrowed_account.h"
@@ -434,9 +435,9 @@ fd_bpf_execute( fd_exec_instr_ctx_t * instr_ctx,
434435
}
435436

436437
/* For dumping syscalls for seed corpora */
437-
int dump_syscall_to_pb = instr_ctx->runtime->log.capture_ctx &&
438-
fd_bank_slot_get( instr_ctx->bank ) >= instr_ctx->runtime->log.capture_ctx->dump_proto_start_slot &&
439-
instr_ctx->runtime->log.capture_ctx->dump_syscall_to_pb;
438+
int dump_syscall_to_pb = instr_ctx->runtime->log.dump_proto_ctx &&
439+
fd_bank_slot_get( instr_ctx->bank )>=instr_ctx->runtime->log.dump_proto_ctx->dump_proto_start_slot &&
440+
instr_ctx->runtime->log.dump_proto_ctx->dump_syscall_to_pb;
440441

441442
/* https://github.com/anza-xyz/agave/blob/v3.1.1/programs/bpf_loader/src/lib.rs#L1525-L1528 */
442443
ulong r2_initial_value = provide_instruction_data_offset_in_vm_r2 ? instruction_data_offset : 0UL;

0 commit comments

Comments
 (0)