Skip to content

Commit cf04265

Browse files
committed
fuzz: clean up and organize fuzzing harnesses
1 parent 59d6207 commit cf04265

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3140
-3275
lines changed

src/flamenco/runtime/fd_executor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#include "../../ballet/poh/fd_poh.h"
1111
#include "../types/fd_types_yaml.h"
1212
#include "../log_collector/fd_log_collector.h"
13-
#include "tests/generated/invoke.pb.h"
14-
#include "tests/generated/txn.pb.h"
13+
#include "tests/harness/generated/invoke.pb.h"
14+
#include "tests/harness/generated/txn.pb.h"
1515
#include "../features/fd_features.h"
1616
#include "fd_runtime.h"
1717

src/flamenco/runtime/tests/Local.mk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
$(call add-hdrs,generated/context.pb.h,generated/elf.pb.h,generated/invoke.pb.h,generated/txn.pb.h,generated/block.pb.h,generated/vm.pb.h,generated/shred.pb.h generated/metadata.pb.h generated/pack.pb.h)
2-
$(call add-objs,generated/context.pb generated/elf.pb generated/invoke.pb generated/txn.pb generated/block.pb generated/vm.pb generated/shred.pb generated/metadata.pb generated/pack.pb,fd_flamenco)
1+
$(call add-hdrs,harness/generated/context.pb.h,harness/generated/elf.pb.h,harness/generated/invoke.pb.h,harness/generated/txn.pb.h,harness/generated/block.pb.h,harness/generated/vm.pb.h,harness/generated/shred.pb.h harness/generated/metadata.pb.h harness/generated/pack.pb.h)
2+
$(call add-objs,harness/generated/context.pb harness/generated/elf.pb harness/generated/invoke.pb harness/generated/txn.pb harness/generated/block.pb harness/generated/vm.pb harness/generated/shred.pb harness/generated/metadata.pb harness/generated/pack.pb,fd_flamenco)
33

44
ifdef FD_HAS_INT128
55
ifdef FD_HAS_SECP256K1
6-
$(call add-hdrs,fd_exec_instr_test.h fd_vm_test.h fd_pack_test.h fd_types_test.h)
7-
$(call add-objs,fd_exec_instr_test fd_vm_test fd_pack_test fd_types_test,fd_flamenco)
8-
$(call add-objs,fd_exec_sol_compat,fd_flamenco)
6+
$(call add-hdrs,harness/fd_elf_harness.h harness/fd_instr_harness.h harness/fd_txn_harness.h harness/fd_block_harness.h harness/fd_harness_common.h harness/fd_vm_harness.h harness/fd_pack_harness.h harness/fd_types_harness.h)
7+
$(call add-objs,harness/fd_elf_harness harness/fd_instr_harness harness/fd_txn_harness harness/fd_block_harness harness/fd_harness_common harness/fd_vm_harness harness/fd_pack_harness harness/fd_types_harness,fd_flamenco)
8+
$(call add-objs,harness/fd_exec_sol_compat,fd_flamenco)
99

1010
$(call make-unit-test,test_exec_sol_compat,test_exec_sol_compat,fd_flamenco fd_funk fd_ballet fd_util fd_disco,$(SECP256K1_LIBS))
11-
$(call make-shared,libfd_exec_sol_compat.so,fd_exec_sol_compat,fd_flamenco fd_funk fd_ballet fd_util fd_disco,$(SECP256K1_LIBS))
11+
$(call make-shared,libfd_exec_sol_compat.so,harness/fd_exec_sol_compat,fd_flamenco fd_funk fd_ballet fd_util fd_disco,$(SECP256K1_LIBS))
1212

1313
ifdef FD_HAS_FUZZ_STUBS
1414
# The --wrap flag stubs out a function so that we can replace it with our own implementation in the fuzz harness(es)
15-
# See __wrap_fd_execute_instr in fd_exec_instr_test.c for example
15+
# See __wrap_fd_execute_instr in fd_vm_harness.c for example
1616
# We guard this with FD_HAS_FUZZ_STUBS because the --wrap flag may not be portable across linkers
1717
WRAP_FLAGS += -Xlinker --wrap=fd_execute_instr
18-
$(call make-shared,libfd_exec_sol_compat_stubbed.so,fd_exec_sol_compat,fd_flamenco fd_funk fd_ballet fd_util fd_disco,$(SECP256K1_LIBS) $(WRAP_FLAGS))
18+
$(call make-shared,libfd_exec_sol_compat_stubbed.so,harness/fd_exec_sol_compat,fd_flamenco fd_funk fd_ballet fd_util fd_disco,$(SECP256K1_LIBS) $(WRAP_FLAGS))
1919
$(call make-unit-test,test_exec_sol_compat_stubbed,test_exec_sol_compat,fd_flamenco fd_funk fd_ballet fd_util fd_disco,$(SECP256K1_LIBS) $(WRAP_FLAGS))
2020
endif
2121

src/flamenco/runtime/tests/fd_dump_pb.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "fd_dump_pb.h"
2-
#include "generated/invoke.pb.h"
3-
#include "generated/vm.pb.h"
2+
#include "harness/generated/invoke.pb.h"
3+
#include "harness/generated/vm.pb.h"
44
#include "../fd_system_ids.h"
55
#include "../fd_runtime.h"
66
#include "../program/fd_address_lookup_table_program.h"
@@ -1030,10 +1030,11 @@ fd_dump_txn_to_protobuf( fd_exec_txn_ctx_t * txn_ctx, fd_spad_t * spad ) {
10301030
} FD_SPAD_FRAME_END;
10311031
}
10321032

1033-
void fd_dump_block_to_protobuf( fd_exec_slot_ctx_t const * slot_ctx,
1034-
fd_capture_ctx_t const * capture_ctx,
1035-
fd_spad_t * spad,
1036-
fd_exec_test_block_context_t * block_context_msg /* output */ ) {
1033+
void
1034+
fd_dump_block_to_protobuf( fd_exec_slot_ctx_t const * slot_ctx,
1035+
fd_capture_ctx_t const * capture_ctx,
1036+
fd_spad_t * spad,
1037+
fd_exec_test_block_context_t * block_context_msg /* output */ ) {
10371038
/* No spad frame because these allocations must persist beyond the lifetime of this function call */
10381039
if( FD_UNLIKELY( capture_ctx==NULL ) ) {
10391040
FD_LOG_WARNING(( "Capture context may not be NULL when dumping blocks." ));

src/flamenco/runtime/tests/fd_dump_pb.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
HARNESS-SPECIFIC FILTERS:
1717
Instructions:
18-
--dump-instr-to-pb <0/1>
18+
--dump-insn-to-pb <0/1>
1919
* If enabled, instructions will be dumped to the specified output directory
2020
* File name format is "instr-<base58_enc_sig>-<instruction_idx>.bin", where instruction_idx is 1-indexed
2121
* Each file represents a single instruction as a serialized InstrContext Protobuf message
@@ -47,7 +47,7 @@
4747
#include "../info/fd_instr_info.h"
4848
#include "../info/fd_runtime_block_info.h"
4949
#include "../../vm/fd_vm.h"
50-
#include "generated/block.pb.h"
50+
#include "harness/generated/block.pb.h"
5151

5252
FD_PROTOTYPES_BEGIN
5353

@@ -76,10 +76,11 @@ fd_dump_txn_to_protobuf( fd_exec_txn_ctx_t *txn_ctx, fd_spad_t * spad );
7676
fail / segfault when dumping the last block of a partitioned epoch rewards distribution run. This will be fixed once the
7777
lifetime of the partitions can exist beyond the rewards distribution period so that we don't have to push and pop
7878
spad frames in disjoint sections of the runtime. */
79-
void fd_dump_block_to_protobuf( fd_exec_slot_ctx_t const * slot_ctx,
80-
fd_capture_ctx_t const * capture_ctx,
81-
fd_spad_t * spad,
82-
fd_exec_test_block_context_t * block_context_msg /* output */ );
79+
void
80+
fd_dump_block_to_protobuf( fd_exec_slot_ctx_t const * slot_ctx,
81+
fd_capture_ctx_t const * capture_ctx,
82+
fd_spad_t * spad,
83+
fd_exec_test_block_context_t * block_context_msg /* output */ );
8384

8485
void
8586
fd_dump_block_to_protobuf_tx_only( fd_runtime_block_info_t const * block_info,

0 commit comments

Comments
 (0)