1414#include "../../flamenco/fd_flamenco.h"
1515#include "../../flamenco/nanopb/pb_decode.h"
1616#include "../../flamenco/runtime/fd_hashes.h"
17- #include "../../funk/fd_funk_filemap .h"
17+ #include "../../funkier/fd_funkier_filemap .h"
1818#include "../../flamenco/types/fd_types.h"
1919#include "../../flamenco/runtime/fd_runtime.h"
2020#include "../../flamenco/runtime/fd_runtime_public.h"
@@ -38,7 +38,7 @@ struct fd_ledger_args {
3838 fd_wksp_t * status_cache_wksp ; /* wksp for status cache. */
3939 fd_blockstore_t blockstore_ljoin ;
4040 fd_blockstore_t * blockstore ; /* blockstore for replay */
41- fd_funk_t * funk ; /* handle to funk */
41+ fd_funkier_t * funk ; /* handle to funk */
4242 fd_alloc_t * alloc ; /* handle to alloc */
4343 char const * cmd ; /* user passed command to fd_ledger */
4444 ulong start_slot ; /* start slot for offline replay */
@@ -56,7 +56,7 @@ struct fd_ledger_args {
5656 ulong index_max ; /* size of funk index (same as rec max) */
5757 char const * funk_file ; /* path to funk backing store */
5858 ulong funk_page_cnt ;
59- fd_funk_close_file_args_t funk_close_args ;
59+ fd_funkier_close_file_args_t funk_close_args ;
6060 char const * snapshot ; /* path to agave snapshot */
6161 char const * incremental ; /* path to agave incremental snapshot */
6262 char const * genesis ; /* path to agave genesis */
@@ -664,7 +664,6 @@ allocator_setup( fd_wksp_t * wksp ) {
664664void
665665fd_ledger_main_setup ( fd_ledger_args_t * args ) {
666666 fd_flamenco_boot ( NULL , NULL );
667- fd_funk_t * funk = args -> funk ;
668667
669668 /* Setup capture context */
670669 int has_solcap = args -> capture_fpath && args -> capture_fpath [0 ] != '\0' ;
@@ -720,9 +719,7 @@ fd_ledger_main_setup( fd_ledger_args_t * args ) {
720719 fd_runtime_update_leaders ( args -> slot_ctx , args -> slot_ctx -> slot_bank .slot , args -> runtime_spad );
721720 fd_calculate_epoch_accounts_hash_values ( args -> slot_ctx );
722721
723- fd_funk_start_write ( funk );
724722 fd_bpf_scan_and_create_bpf_program_cache_entry_tpool ( args -> slot_ctx , args -> slot_ctx -> funk_txn , args -> tpool , args -> runtime_spad );
725- fd_funk_end_write ( funk );
726723
727724 /* First, load in the sysvars into the sysvar cache. This is required to
728725 make the StakeHistory sysvar available to the rewards calculation. */
@@ -902,21 +899,20 @@ parse_rocksdb_list( fd_ledger_args_t * args,
902899
903900void
904901init_funk ( fd_ledger_args_t * args ) {
905- fd_funk_t * funk ;
902+ fd_funkier_t * funk ;
906903 if ( args -> restore_funk ) {
907- funk = fd_funk_recover_checkpoint ( args -> funk_file , 1 , args -> restore_funk , & args -> funk_close_args );
904+ funk = fd_funkier_recover_checkpoint ( args -> funk_file , 1 , args -> restore_funk , & args -> funk_close_args );
908905 } else {
909- funk = fd_funk_open_file ( args -> funk_file , 1 , args -> hashseed , args -> txns_max , args -> index_max , args -> funk_page_cnt * (1UL <<30 ), FD_FUNK_OVERWRITE , & args -> funk_close_args );
906+ funk = fd_funkier_open_file ( args -> funk_file , 1 , args -> hashseed , args -> txns_max , args -> index_max , args -> funk_page_cnt * (1UL <<30 ), FD_FUNKIER_OVERWRITE , & args -> funk_close_args );
910907 }
911908 args -> funk = funk ;
912- args -> funk_wksp = fd_funk_wksp ( funk );
913- FD_LOG_NOTICE (( "funky at global address 0x%016lx with %lu records" , fd_wksp_gaddr_fast ( args -> funk_wksp , funk ),
914- fd_funk_rec_cnt ( fd_funk_rec_map ( funk , args -> funk_wksp ) ) ));
909+ args -> funk_wksp = fd_funkier_wksp ( funk );
910+ FD_LOG_NOTICE (( "funky at global address 0x%016lx" , fd_wksp_gaddr_fast ( args -> funk_wksp , funk ) ));
915911}
916912
917913void
918914cleanup_funk ( fd_ledger_args_t * args ) {
919- fd_funk_close_file ( & args -> funk_close_args );
915+ fd_funkier_close_file ( & args -> funk_close_args );
920916}
921917
922918void
@@ -958,13 +954,7 @@ checkpt( fd_ledger_args_t * args ) {
958954 }
959955 FD_LOG_NOTICE (( "writing funk checkpt %s" , args -> checkpt_funk ));
960956 unlink ( args -> checkpt_funk );
961- #ifdef FD_FUNK_WKSP_PROTECT
962- fd_wksp_mprotect ( args -> funk_wksp , 0 );
963- #endif
964957 int err = fd_wksp_checkpt ( args -> funk_wksp , args -> checkpt_funk , 0666 , 0 , NULL );
965- #ifdef FD_FUNK_WKSP_PROTECT
966- fd_wksp_mprotect ( args -> funk_wksp , 1 );
967- #endif
968958 if ( err ) {
969959 FD_LOG_ERR (( "funk checkpt failed: error %d" , err ));
970960 }
@@ -1085,7 +1075,7 @@ ingest( fd_ledger_args_t * args ) {
10851075
10861076 fd_spad_t * spad = args -> runtime_spad ;
10871077
1088- fd_funk_t * funk = args -> funk ;
1078+ fd_funkier_t * funk = args -> funk ;
10891079
10901080 args -> valloc = allocator_setup ( args -> wksp );
10911081 uchar * epoch_ctx_mem = fd_spad_alloc ( spad , fd_exec_epoch_ctx_align (), fd_exec_epoch_ctx_footprint ( args -> vote_acct_max ) );
@@ -1129,7 +1119,7 @@ ingest( fd_ledger_args_t * args ) {
11291119 args -> exec_spads ,
11301120 args -> exec_spad_cnt ,
11311121 args -> runtime_spad );
1132- FD_LOG_NOTICE (( "imported %lu records from snapshot" , fd_funk_rec_cnt ( fd_funk_rec_map ( funk , fd_funk_wksp ( funk ) ) ) ));
1122+ FD_LOG_NOTICE (( "imported records from snapshot" ));
11331123 }
11341124 if ( args -> incremental ) {
11351125 fd_snapshot_load_all ( args -> incremental ,
@@ -1142,7 +1132,7 @@ ingest( fd_ledger_args_t * args ) {
11421132 args -> exec_spads ,
11431133 args -> exec_spad_cnt ,
11441134 args -> runtime_spad );
1145- FD_LOG_NOTICE (( "imported %lu records from incremental snapshot" , fd_funk_rec_cnt ( fd_funk_rec_map ( funk , fd_funk_wksp ( funk ) ) ) ));
1135+ FD_LOG_NOTICE (( "imported records from incremental snapshot" ));
11461136 }
11471137
11481138 if ( args -> genesis ) {
@@ -1185,12 +1175,14 @@ ingest( fd_ledger_args_t * args ) {
11851175 }
11861176 }
11871177
1178+ #ifdef FD_FUNKIER_HANDHOLDING
11881179 if ( args -> verify_funk ) {
11891180 FD_LOG_NOTICE (( "verifying funky" ));
1190- if ( fd_funk_verify ( funk ) ) {
1181+ if ( fd_funkier_verify ( funk ) ) {
11911182 FD_LOG_ERR (( "verification failed" ));
11921183 }
11931184 }
1185+ #endif
11941186
11951187 checkpt ( args );
11961188
@@ -1259,7 +1251,7 @@ replay( fd_ledger_args_t * args ) {
12591251
12601252
12611253 /* Setup slot_ctx */
1262- fd_funk_t * funk = args -> funk ;
1254+ fd_funkier_t * funk = args -> funk ;
12631255
12641256 void * epoch_ctx_mem = fd_spad_alloc ( spad , FD_EXEC_EPOCH_CTX_ALIGN , fd_exec_epoch_ctx_footprint ( args -> vote_acct_max ) );
12651257 fd_memset ( epoch_ctx_mem , 0 , fd_exec_epoch_ctx_footprint ( args -> vote_acct_max ) );
@@ -1304,22 +1296,19 @@ replay( fd_ledger_args_t * args ) {
13041296 /* Check number of records in funk. If rec_cnt == 0, then it can be assumed
13051297 that you need to load in snapshot(s). */
13061298
1307- ulong rec_cnt = fd_funk_rec_cnt ( fd_funk_rec_map ( funk , fd_funk_wksp ( funk ) ) );
1308- if ( !rec_cnt ) {
1309- /* Load in snapshot(s) */
1310- if ( args -> snapshot ) {
1311- fd_snapshot_load_all ( args -> snapshot ,
1312- args -> slot_ctx ,
1313- NULL ,
1314- args -> tpool ,
1315- args -> verify_acc_hash ,
1316- args -> check_acc_hash ,
1317- FD_SNAPSHOT_TYPE_FULL ,
1318- args -> exec_spads ,
1319- args -> exec_spad_cnt ,
1320- args -> runtime_spad );
1321- FD_LOG_NOTICE (( "imported %lu records from snapshot" , fd_funk_rec_cnt ( fd_funk_rec_map ( funk , fd_funk_wksp ( funk ) ) ) ));
1322- }
1299+ /* Load in snapshot(s) */
1300+ if ( args -> snapshot ) {
1301+ fd_snapshot_load_all ( args -> snapshot ,
1302+ args -> slot_ctx ,
1303+ NULL ,
1304+ args -> tpool ,
1305+ args -> verify_acc_hash ,
1306+ args -> check_acc_hash ,
1307+ FD_SNAPSHOT_TYPE_FULL ,
1308+ args -> exec_spads ,
1309+ args -> exec_spad_cnt ,
1310+ args -> runtime_spad );
1311+ FD_LOG_NOTICE (( "imported from snapshot" ));
13231312 if ( args -> incremental ) {
13241313 fd_snapshot_load_all ( args -> incremental ,
13251314 args -> slot_ctx ,
@@ -1331,13 +1320,11 @@ replay( fd_ledger_args_t * args ) {
13311320 args -> exec_spads ,
13321321 args -> exec_spad_cnt ,
13331322 args -> runtime_spad );
1334- FD_LOG_NOTICE (( "imported %lu records from snapshot" , fd_funk_rec_cnt ( fd_funk_rec_map ( funk , fd_funk_wksp ( funk ) ) ) ));
1335- }
1336- if ( args -> genesis ) {
1337- fd_runtime_read_genesis ( args -> slot_ctx , args -> genesis , args -> snapshot != NULL , NULL , args -> tpool , args -> runtime_spad );
1323+ FD_LOG_NOTICE (( "imported from snapshot" ));
13381324 }
1339- } else {
1340- FD_LOG_NOTICE (( "found funk with %lu records" , rec_cnt ));
1325+ }
1326+ if ( args -> genesis ) {
1327+ fd_runtime_read_genesis ( args -> slot_ctx , args -> genesis , args -> snapshot != NULL , NULL , args -> tpool , args -> runtime_spad );
13411328 }
13421329
13431330 FD_LOG_NOTICE (( "Used memory in spad after loading in snapshot %lu" , args -> runtime_spad -> mem_used ));
0 commit comments