Skip to content

Commit

Permalink
flamenco: remove unused account compute table from slot ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
mjain-jump committed Jan 9, 2025
1 parent 1c341d8 commit bade3ea
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 43 deletions.
11 changes: 10 additions & 1 deletion src/app/fdctl/run/tiles/fd_gossip.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,21 @@

static volatile ulong * fd_shred_version;

static int
fd_pubkey_eq( fd_pubkey_t const * key1, fd_pubkey_t const * key2 ) {
return memcmp( key1->key, key2->key, sizeof(fd_pubkey_t) ) == 0;
}

static ulong
fd_pubkey_hash( fd_pubkey_t const * key, ulong seed ) {
return fd_hash( seed, key->key, sizeof(fd_pubkey_t) );
}

/* Contact info table */
#define MAP_NAME fd_contact_info_table
#define MAP_KEY_T fd_pubkey_t
#define MAP_KEY_EQ fd_pubkey_eq
#define MAP_KEY_HASH fd_pubkey_hash
#define MAP_KEY_COPY fd_pubkey_copy
#define MAP_T fd_contact_info_elem_t
#include "../../../../util/tmpl/fd_map_giant.c"

Expand Down
2 changes: 1 addition & 1 deletion src/disco/rpcserver/fd_rpc_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -2643,7 +2643,7 @@ fd_rpc_replay_after_frag(fd_rpc_ctx_t * ctx, fd_replay_notif_msg_t * msg) {
for( ulong j = 0; j < subs->sub_cnt; ++j ) {
struct fd_ws_subscription * sub = &subs->sub_list[ j ];
if( sub->meth_id == KEYW_WS_METHOD_ACCOUNTSUBSCRIBE &&
fd_pubkey_eq( &id, &sub->acct_subscribe.acct ) ) {
!memcmp( &id, &sub->acct_subscribe.acct, sizeof(fd_pubkey_t) ) ) {
if( ws_method_accountSubscribe_update( ctx, msg, sub ) )
fd_web_ws_send( &subs->ws, sub->conn_id );
}
Expand Down
3 changes: 0 additions & 3 deletions src/flamenco/runtime/context/fd_exec_slot_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ fd_exec_slot_ctx_new( void * mem,
fd_slot_bank_new(&self->slot_bank);

self->sysvar_cache = fd_sysvar_cache_new( fd_valloc_malloc( valloc, fd_sysvar_cache_align(), fd_sysvar_cache_footprint() ), valloc );
self->account_compute_table = fd_account_compute_table_join( fd_account_compute_table_new( fd_valloc_malloc( valloc, fd_account_compute_table_align(), fd_account_compute_table_footprint( 10000 ) ), 10000, 0 ) );

/* This is inactive by default */
self->epoch_reward_status.discriminant = fd_epoch_reward_status_enum_Inactive;
Expand Down Expand Up @@ -93,8 +92,6 @@ fd_exec_slot_ctx_delete( void * mem ) {

fd_valloc_free( hdr->valloc, fd_sysvar_cache_delete( hdr->sysvar_cache ) );
hdr->sysvar_cache = NULL;
fd_valloc_free( hdr->valloc, fd_account_compute_table_delete( fd_account_compute_table_leave( hdr->account_compute_table ) ) );
hdr->account_compute_table = NULL;

FD_COMPILER_MFENCE();
FD_VOLATILE( hdr->magic ) = 0UL;
Expand Down
32 changes: 0 additions & 32 deletions src/flamenco/runtime/context/fd_exec_slot_ctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,6 @@
#include "../../types/fd_types.h"
#include "../fd_txncache.h"

struct fd_account_compute_elem {
fd_pubkey_t key;
ulong next;
ulong cu_consumed;
};
typedef struct fd_account_compute_elem fd_account_compute_elem_t;

static int
fd_pubkey_eq( fd_pubkey_t const * key1, fd_pubkey_t const * key2 ) {
return memcmp( key1->key, key2->key, sizeof(fd_pubkey_t) ) == 0;
}

static ulong
fd_pubkey_hash( fd_pubkey_t const * key, ulong seed ) {
return fd_hash( seed, key->key, sizeof(fd_pubkey_t) );
}

static void
fd_pubkey_copy( fd_pubkey_t * keyd, fd_pubkey_t const * keys ) {
memcpy( keyd->key, keys->key, sizeof(fd_pubkey_t) );
}

/* Contact info table */
#define MAP_NAME fd_account_compute_table
#define MAP_KEY_T fd_pubkey_t
#define MAP_KEY_EQ fd_pubkey_eq
#define MAP_KEY_HASH fd_pubkey_hash
#define MAP_KEY_COPY fd_pubkey_copy
#define MAP_T fd_account_compute_elem_t
#include "../../../util/tmpl/fd_map_giant.c"

/* fd_exec_slot_ctx_t is the context that stays constant during all
transactions in a block. */

Expand Down Expand Up @@ -76,7 +45,6 @@ struct __attribute__((aligned(8UL))) fd_exec_slot_ctx {
ulong total_compute_units_used;

fd_sysvar_cache_t * sysvar_cache;
fd_account_compute_elem_t * account_compute_table;

fd_txncache_t * status_cache;
fd_slot_history_t slot_history[1];
Expand Down
6 changes: 0 additions & 6 deletions src/flamenco/runtime/fd_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1242,12 +1242,6 @@ fd_runtime_block_execute_finalize_tpool( fd_exec_slot_ctx_t * slot_ctx,
fd_funk_end_write( slot_ctx->acc_mgr->funk );

slot_ctx->total_compute_units_requested = 0UL;
for ( fd_account_compute_table_iter_t iter = fd_account_compute_table_iter_init( slot_ctx->account_compute_table );
!fd_account_compute_table_iter_done( slot_ctx->account_compute_table, iter );
iter = fd_account_compute_table_iter_next( slot_ctx->account_compute_table, iter ) ) {
fd_account_compute_elem_t * e = fd_account_compute_table_iter_ele( slot_ctx->account_compute_table, iter );
fd_account_compute_table_remove( slot_ctx->account_compute_table, &e->key );
}

return FD_RUNTIME_EXECUTE_SUCCESS;
}
Expand Down

0 comments on commit bade3ea

Please sign in to comment.