Skip to content

Commit a8bd2e9

Browse files
flamenco, choreo, app: integrate new Funkier
1 parent 0a59968 commit a8bd2e9

File tree

75 files changed

+1272
-1152
lines changed

Some content is hidden

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

75 files changed

+1272
-1152
lines changed

src/app/fdctl/topos/fd_firedancer.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ fd_topo_initialize( config_t * config ) {
299299
/**/ fd_topob_link( topo, "rstart_gossi", "rstart_gossi", 128UL, 4UL + 128UL + 8192UL, 1UL );
300300
/**/ fd_topob_link( topo, "gossi_rstart", "gossi_rstart", 128UL, 4UL + 128UL + 8192UL, 1UL );
301301
/**/ fd_topob_link( topo, "rstart_store", "rstart_store", 128UL, sizeof(ulong) * 2, 1UL );
302-
/**/ fd_topob_link( topo, "store_rstart", "store_rstart", 128UL, sizeof(fd_funk_txn_xid_t), 1UL );
302+
/**/ fd_topob_link( topo, "store_rstart", "store_rstart", 128UL, sizeof(fd_funkier_txn_xid_t), 1UL );
303303

304304
ushort parsed_tile_to_cpu[ FD_TILE_MAX ];
305305
/* Unassigned tiles will be floating, unless auto topology is enabled. */

src/app/ledger/main.c

+33-46
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
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_borrowed_account.h"
@@ -37,7 +37,7 @@ struct fd_ledger_args {
3737
fd_wksp_t * status_cache_wksp; /* wksp for status cache. */
3838
fd_blockstore_t blockstore_ljoin;
3939
fd_blockstore_t * blockstore; /* blockstore for replay */
40-
fd_funk_t * funk; /* handle to funk */
40+
fd_funkier_t * funk; /* handle to funk */
4141
fd_alloc_t * alloc; /* handle to alloc */
4242
char const * cmd; /* user passed command to fd_ledger */
4343
ulong start_slot; /* start slot for offline replay */
@@ -55,7 +55,7 @@ struct fd_ledger_args {
5555
ulong index_max; /* size of funk index (same as rec max) */
5656
char const * funk_file; /* path to funk backing store */
5757
ulong funk_page_cnt;
58-
fd_funk_close_file_args_t funk_close_args;
58+
fd_funkier_close_file_args_t funk_close_args;
5959
char const * snapshot; /* path to agave snapshot */
6060
char const * incremental; /* path to agave incremental snapshot */
6161
char const * genesis; /* path to agave genesis */
@@ -679,7 +679,6 @@ allocator_setup( fd_wksp_t * wksp ) {
679679
void
680680
fd_ledger_main_setup( fd_ledger_args_t * args ) {
681681
fd_flamenco_boot( NULL, NULL );
682-
fd_funk_t * funk = args->funk;
683682

684683
/* Setup capture context */
685684
int has_solcap = args->capture_fpath && args->capture_fpath[0] != '\0';
@@ -735,9 +734,7 @@ fd_ledger_main_setup( fd_ledger_args_t * args ) {
735734
fd_runtime_update_leaders( args->slot_ctx, args->slot_ctx->slot_bank.slot, args->runtime_spad );
736735
fd_calculate_epoch_accounts_hash_values( args->slot_ctx );
737736

738-
fd_funk_start_write( funk );
739737
fd_bpf_scan_and_create_bpf_program_cache_entry_tpool( args->slot_ctx, args->slot_ctx->funk_txn, args->tpool, args->runtime_spad );
740-
fd_funk_end_write( funk );
741738

742739
/* First, load in the sysvars into the sysvar cache. This is required to
743740
make the StakeHistory sysvar available to the rewards calculation. */
@@ -917,21 +914,20 @@ parse_rocksdb_list( fd_ledger_args_t * args,
917914

918915
void
919916
init_funk( fd_ledger_args_t * args ) {
920-
fd_funk_t * funk;
917+
fd_funkier_t * funk;
921918
if( args->restore_funk ) {
922-
funk = fd_funk_recover_checkpoint( args->funk_file, 1, args->restore_funk, &args->funk_close_args );
919+
funk = fd_funkier_recover_checkpoint( args->funk_file, 1, args->restore_funk, &args->funk_close_args );
923920
} else {
924-
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 );
921+
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 );
925922
}
926923
args->funk = funk;
927-
args->funk_wksp = fd_funk_wksp( funk );
928-
FD_LOG_NOTICE(( "funky at global address 0x%016lx with %lu records", fd_wksp_gaddr_fast( args->funk_wksp, funk ),
929-
fd_funk_rec_cnt( fd_funk_rec_map( funk, args->funk_wksp ) ) ));
924+
args->funk_wksp = fd_funkier_wksp( funk );
925+
FD_LOG_NOTICE(( "funky at global address 0x%016lx", fd_wksp_gaddr_fast( args->funk_wksp, funk ) ));
930926
}
931927

932928
void
933929
cleanup_funk( fd_ledger_args_t * args ) {
934-
fd_funk_close_file( &args->funk_close_args );
930+
fd_funkier_close_file( &args->funk_close_args );
935931
}
936932

937933
void
@@ -973,13 +969,7 @@ checkpt( fd_ledger_args_t * args ) {
973969
}
974970
FD_LOG_NOTICE(( "writing funk checkpt %s", args->checkpt_funk ));
975971
unlink( args->checkpt_funk );
976-
#ifdef FD_FUNK_WKSP_PROTECT
977-
fd_wksp_mprotect( args->funk_wksp, 0 );
978-
#endif
979972
int err = fd_wksp_checkpt( args->funk_wksp, args->checkpt_funk, 0666, 0, NULL );
980-
#ifdef FD_FUNK_WKSP_PROTECT
981-
fd_wksp_mprotect( args->funk_wksp, 1 );
982-
#endif
983973
if( err ) {
984974
FD_LOG_ERR(( "funk checkpt failed: error %d", err ));
985975
}
@@ -1100,7 +1090,7 @@ ingest( fd_ledger_args_t * args ) {
11001090

11011091
fd_spad_t * spad = args->runtime_spad;
11021092

1103-
fd_funk_t * funk = args->funk;
1093+
fd_funkier_t * funk = args->funk;
11041094

11051095
args->valloc = allocator_setup( args->wksp );
11061096
uchar * epoch_ctx_mem = fd_spad_alloc( spad, fd_exec_epoch_ctx_align(), fd_exec_epoch_ctx_footprint( args->vote_acct_max ) );
@@ -1144,7 +1134,7 @@ ingest( fd_ledger_args_t * args ) {
11441134
args->exec_spads,
11451135
args->exec_spad_cnt,
11461136
args->runtime_spad );
1147-
FD_LOG_NOTICE(( "imported %lu records from snapshot", fd_funk_rec_cnt( fd_funk_rec_map( funk, fd_funk_wksp( funk ) ) ) ));
1137+
FD_LOG_NOTICE(( "imported records from snapshot" ));
11481138
}
11491139
if( args->incremental ) {
11501140
fd_snapshot_load_all( args->incremental,
@@ -1157,7 +1147,7 @@ ingest( fd_ledger_args_t * args ) {
11571147
args->exec_spads,
11581148
args->exec_spad_cnt,
11591149
args->runtime_spad );
1160-
FD_LOG_NOTICE(( "imported %lu records from incremental snapshot", fd_funk_rec_cnt( fd_funk_rec_map( funk, fd_funk_wksp( funk ) ) ) ));
1150+
FD_LOG_NOTICE(( "imported records from incremental snapshot" ));
11611151
}
11621152

11631153
if( args->genesis ) {
@@ -1200,12 +1190,14 @@ ingest( fd_ledger_args_t * args ) {
12001190
}
12011191
}
12021192

1193+
#ifdef FD_FUNKIER_HANDHOLDING
12031194
if( args->verify_funk ) {
12041195
FD_LOG_NOTICE(( "verifying funky" ));
1205-
if( fd_funk_verify( funk ) ) {
1196+
if( fd_funkier_verify( funk ) ) {
12061197
FD_LOG_ERR(( "verification failed" ));
12071198
}
12081199
}
1200+
#endif
12091201

12101202
checkpt( args );
12111203

@@ -1260,7 +1252,7 @@ replay( fd_ledger_args_t * args ) {
12601252

12611253

12621254
/* Setup slot_ctx */
1263-
fd_funk_t * funk = args->funk;
1255+
fd_funkier_t * funk = args->funk;
12641256

12651257
void * epoch_ctx_mem = fd_spad_alloc( spad, FD_EXEC_EPOCH_CTX_ALIGN, fd_exec_epoch_ctx_footprint( args->vote_acct_max ) );
12661258
fd_memset( epoch_ctx_mem, 0, fd_exec_epoch_ctx_footprint( args->vote_acct_max ) );
@@ -1308,22 +1300,19 @@ replay( fd_ledger_args_t * args ) {
13081300
/* Check number of records in funk. If rec_cnt == 0, then it can be assumed
13091301
that you need to load in snapshot(s). */
13101302

1311-
ulong rec_cnt = fd_funk_rec_cnt( fd_funk_rec_map( funk, fd_funk_wksp( funk ) ) );
1312-
if( !rec_cnt ) {
1313-
/* Load in snapshot(s) */
1314-
if( args->snapshot ) {
1315-
fd_snapshot_load_all( args->snapshot,
1316-
args->slot_ctx,
1317-
NULL,
1318-
args->tpool,
1319-
args->verify_acc_hash,
1320-
args->check_acc_hash,
1321-
FD_SNAPSHOT_TYPE_FULL,
1322-
args->exec_spads,
1323-
args->exec_spad_cnt,
1324-
args->runtime_spad );
1325-
FD_LOG_NOTICE(( "imported %lu records from snapshot", fd_funk_rec_cnt( fd_funk_rec_map( funk, fd_funk_wksp( funk ) ) ) ));
1326-
}
1303+
/* Load in snapshot(s) */
1304+
if( args->snapshot ) {
1305+
fd_snapshot_load_all( args->snapshot,
1306+
args->slot_ctx,
1307+
NULL,
1308+
args->tpool,
1309+
args->verify_acc_hash,
1310+
args->check_acc_hash,
1311+
FD_SNAPSHOT_TYPE_FULL,
1312+
args->exec_spads,
1313+
args->exec_spad_cnt,
1314+
args->runtime_spad );
1315+
FD_LOG_NOTICE(( "imported from snapshot" ));
13271316
if( args->incremental ) {
13281317
fd_snapshot_load_all( args->incremental,
13291318
args->slot_ctx,
@@ -1335,13 +1324,11 @@ replay( fd_ledger_args_t * args ) {
13351324
args->exec_spads,
13361325
args->exec_spad_cnt,
13371326
args->runtime_spad );
1338-
FD_LOG_NOTICE(( "imported %lu records from snapshot", fd_funk_rec_cnt( fd_funk_rec_map( funk, fd_funk_wksp( funk ) ) ) ));
1339-
}
1340-
if( args->genesis ) {
1341-
fd_runtime_read_genesis( args->slot_ctx, args->genesis, args->snapshot != NULL, NULL, args->tpool, args->runtime_spad );
1327+
FD_LOG_NOTICE(( "imported from snapshot" ));
13421328
}
1343-
} else {
1344-
FD_LOG_NOTICE(( "found funk with %lu records", rec_cnt ));
1329+
}
1330+
if( args->genesis ) {
1331+
fd_runtime_read_genesis( args->slot_ctx, args->genesis, args->snapshot != NULL, NULL, args->tpool, args->runtime_spad );
13451332
}
13461333

13471334
FD_LOG_NOTICE(( "Used memory in spad after loading in snapshot %lu", args->runtime_spad->mem_used ));

src/app/rpcserver/main.c

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#define _DEFAULT_SOURCE
22

3-
#include "../../discof/rpcserver/fd_rpc_service.h"
4-
#include "../../funk/fd_funk_filemap.h"
5-
63
#include <fcntl.h>
74
#include <stdio.h>
85
#include <stdlib.h>
@@ -13,6 +10,8 @@
1310
#include <sys/socket.h>
1411
#include <netinet/in.h>
1512
#include <arpa/inet.h>
13+
#include "../../discof/rpcserver/fd_rpc_service.h"
14+
#include "../../funkier/fd_funkier_filemap.h"
1615

1716
#define SHAM_LINK_CONTEXT fd_rpc_ctx_t
1817
#define SHAM_LINK_STATE fd_replay_notif_msg_t
@@ -33,7 +32,7 @@ init_args( int * argc, char *** argv, fd_rpcserver_args_t * args ) {
3332
char const * funk_file = fd_env_strip_cmdline_cstr( argc, argv, "--funk-file", NULL, NULL );
3433
if( FD_UNLIKELY( !funk_file ))
3534
FD_LOG_ERR(( "--funk-file argument is required" ));
36-
args->funk = fd_funk_open_file( funk_file, 1, 0, 0, 0, 0, FD_FUNK_READONLY, NULL );
35+
args->funk = fd_funkier_open_file( funk_file, 1, 0, 0, 0, 0, FD_FUNKIER_READONLY, NULL );
3736
if( args->funk == NULL ) {
3837
FD_LOG_ERR(( "failed to join a funky" ));
3938
}
@@ -109,9 +108,9 @@ init_args_offline( int * argc, char *** argv, fd_rpcserver_args_t * args ) {
109108
FD_LOG_ERR(( "--funk-file argument is required" ));
110109
char const * restore = fd_env_strip_cmdline_cstr ( argc, argv, "--restore-funk", NULL, NULL );
111110
if( restore != NULL )
112-
args->funk = fd_funk_recover_checkpoint( funk_file, 1, restore, NULL );
111+
args->funk = fd_funkier_recover_checkpoint( funk_file, 1, restore, NULL );
113112
else
114-
args->funk = fd_funk_open_file( funk_file, 1, 0, 0, 0, 0, FD_FUNK_READONLY, NULL );
113+
args->funk = fd_funkier_open_file( funk_file, 1, 0, 0, 0, 0, FD_FUNKIER_READONLY, NULL );
115114

116115
fd_wksp_t * wksp;
117116
const char * wksp_name = fd_env_strip_cmdline_cstr ( argc, argv, "--wksp-name-blockstore", NULL, NULL );

src/choreo/epoch/fd_epoch.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,16 @@ fd_epoch_init( fd_epoch_t * epoch, fd_epoch_bank_t const * epoch_bank ) {
115115
vote_accounts->vote_accounts_root );
116116
curr;
117117
curr = fd_vote_accounts_pair_t_map_successor( vote_accounts->vote_accounts_pool, curr ) ) {
118-
118+
119119
if( FD_UNLIKELY( curr->elem.stake > 0UL ) ) {
120-
120+
121121
#if FD_EPOCH_USE_HANDHOLDING
122122
FD_TEST( !fd_epoch_voters_query( epoch_voters, curr->elem.key, NULL ) );
123123
FD_TEST( fd_epoch_voters_key_cnt( epoch_voters ) < fd_epoch_voters_key_max( epoch_voters ) );
124124
#endif
125125

126126
fd_voter_t * voter = fd_epoch_voters_insert( epoch_voters, curr->elem.key );
127-
voter->rec.c[FD_FUNK_REC_KEY_FOOTPRINT - 1] = FD_FUNK_KEY_TYPE_ACC;
127+
voter->rec.c[FD_FUNKIER_REC_KEY_FOOTPRINT - 1] = FD_FUNK_KEY_TYPE_ACC;
128128

129129
#if FD_EPOCH_USE_HANDHOLDING
130130
FD_TEST( 0 == memcmp( &voter->key, &curr->elem.key, sizeof(fd_pubkey_t) ) );

0 commit comments

Comments
 (0)