Skip to content

Commit b24f96e

Browse files
committed
cost tracker: general tidyness
1 parent 029b63c commit b24f96e

14 files changed

+222
-309
lines changed

src/discof/replay/fd_replay_tile.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -699,11 +699,7 @@ replay_block_start( fd_replay_tile_t * ctx,
699699
&is_epoch_boundary );
700700
if( FD_UNLIKELY( is_epoch_boundary ) ) publish_stake_weights( ctx, stem, bank, 1 );
701701

702-
int res = fd_runtime_block_execute_prepare( bank, ctx->funk, &xid, ctx->capture_ctx, ctx->runtime_spad );
703-
if( FD_UNLIKELY( res!=FD_RUNTIME_EXECUTE_SUCCESS ) ) {
704-
FD_LOG_CRIT(( "block prep execute failed" ));
705-
}
706-
702+
FD_TEST( !fd_runtime_block_execute_prepare( bank, ctx->funk, &xid, ctx->capture_ctx, ctx->runtime_spad ) );
707703
return bank;
708704
}
709705

@@ -922,10 +918,7 @@ prepare_leader_bank( fd_replay_tile_t * ctx,
922918
&is_epoch_boundary );
923919
if( FD_UNLIKELY( is_epoch_boundary ) ) publish_stake_weights( ctx, stem, ctx->leader_bank, 1 );
924920

925-
int res = fd_runtime_block_execute_prepare( ctx->leader_bank, ctx->funk, &xid, ctx->capture_ctx, ctx->runtime_spad );
926-
if( FD_UNLIKELY( res!=FD_RUNTIME_EXECUTE_SUCCESS ) ) {
927-
FD_LOG_CRIT(( "block prep execute failed" ));
928-
}
921+
FD_TEST( !fd_runtime_block_execute_prepare( ctx->leader_bank, ctx->funk, &xid, ctx->capture_ctx, ctx->runtime_spad ) );
929922

930923
/* Now that a bank has been created for the leader slot, increment the
931924
reference count until we are done with the leader slot. */
@@ -1053,7 +1046,7 @@ init_after_snapshot( fd_replay_tile_t * ctx ) {
10531046
fd_sha256_hash( poh->hash, 32UL, poh->hash );
10541047
}
10551048

1056-
FD_TEST( fd_runtime_block_execute_prepare( bank, ctx->funk, &xid, ctx->capture_ctx, ctx->runtime_spad ) == 0 );
1049+
FD_TEST( !fd_runtime_block_execute_prepare( bank, ctx->funk, &xid, ctx->capture_ctx, ctx->runtime_spad ) );
10571050
fd_runtime_block_execute_finalize( bank, ctx->funk, &xid, ctx->capture_ctx, 1 );
10581051

10591052
snapshot_slot = 0UL;

src/flamenco/runtime/fd_bank.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,14 @@ fd_banks_new( void * shmem, ulong max_total_banks, ulong max_fork_width ) {
242242
the offset in the banks. */
243243

244244
fd_bank_cost_tracker_t * cost_tracker_pool = fd_bank_cost_tracker_pool_join( fd_bank_cost_tracker_pool_new( cost_tracker_pool_mem, max_fork_width ) );
245-
if( FD_UNLIKELY( !cost_tracker_pool ) ) {
246-
FD_LOG_WARNING(( "Failed to new or join cost tracker pool" ));
247-
return NULL;
248-
}
245+
FD_TEST( cost_tracker_pool );
249246
fd_banks_set_cost_tracker_pool( banks, cost_tracker_pool );
250247

248+
for( ulong i=0UL; i<max_fork_width; i++ ) {
249+
fd_bank_cost_tracker_t * cost_tracker = fd_bank_cost_tracker_pool_ele( cost_tracker_pool, i );
250+
fd_cost_tracker_join( fd_cost_tracker_new( cost_tracker->data, 88888UL /* TODO: REAL SEED */ ) );
251+
}
252+
251253
/* Now, call _new() and _join() for all of the CoW pools. */
252254
#define HAS_COW_1_LIMIT_1(name) \
253255
fd_rwlock_unwrite( &banks->name##_pool_lock ); \

src/flamenco/runtime/fd_core_bpf_migration.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "program/fd_bpf_loader_program.h"
33
#include "program/fd_builtin_programs.h"
44
#include "fd_pubkey_utils.h"
5+
#include "fd_system_ids.h"
56

67
/* Mimics bank.new_target_program_account(). Assumes out_rec is a
78
modifiable record.

0 commit comments

Comments
 (0)