Skip to content

Commit 8d8bb40

Browse files
flamenco, choreo, app: integrate new Funkier
1 parent 314c3fa commit 8d8bb40

File tree

79 files changed

+1497
-1283
lines changed

Some content is hidden

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

79 files changed

+1497
-1283
lines changed

src/app/fdctl/topos/fd_firedancer.c

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

307307
ushort parsed_tile_to_cpu[ FD_TILE_MAX ];
308308
/* 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_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 ) {
664664
void
665665
fd_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

903900
void
904901
init_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

917913
void
918914
cleanup_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

922918
void
@@ -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 ));

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)