Skip to content

Commit

Permalink
Fix symbol pollution
Browse files Browse the repository at this point in the history
Fixes instances of publicly exported symbols without the 'fd_' prefix.
  • Loading branch information
riptl authored and ripatel-fd committed Dec 10, 2024
1 parent 36bd1a5 commit 31288d7
Show file tree
Hide file tree
Showing 24 changed files with 204 additions and 211 deletions.
2 changes: 1 addition & 1 deletion src/app/ledger/Local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ifdef FD_HAS_ROCKSDB

ifdef FD_HAS_ZSTD
ifdef FD_HAS_SECP256K1
$(call make-bin,fd_ledger,main,fd_flamenco fd_ballet fd_reedsol fd_funk fd_shred fd_tango fd_choreo fd_waltz fd_util fd_disco,$(ROCKSDB_LIBS) $(SECP256K1_LIBS))
$(call make-bin,fd_ledger,main,fd_flamenco fd_ballet fd_reedsol fd_funk fd_tango fd_choreo fd_waltz fd_util fd_disco,$(ROCKSDB_LIBS) $(SECP256K1_LIBS))
else
$(warning ledger tool build disabled due to lack of secp256k1)
endif
Expand Down
2 changes: 1 addition & 1 deletion src/app/rpcserver/Local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ ifdef FD_HAS_HOSTED
ifdef FD_HAS_INT128
CFLAGS+='-DFIREDANCER_VERSION="$(FIREDANCER_VERSION_MAJOR).$(FIREDANCER_VERSION_MINOR).$(FIREDANCER_VERSION_PATCH)"'

$(call make-bin,fd_rpcserver,main,fd_disco fd_flamenco fd_reedsol fd_ballet fd_funk fd_shred fd_tango fd_choreo fd_waltz fd_util, $(SECP256K1_LIBS))
$(call make-bin,fd_rpcserver,main,fd_disco fd_flamenco fd_reedsol fd_ballet fd_funk fd_tango fd_choreo fd_waltz fd_util, $(SECP256K1_LIBS))
endif
endif
6 changes: 3 additions & 3 deletions src/choreo/eqvoc/fd_eqvoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fd_eqvoc_delete( void * eqvoc ) {
return eqvoc;
}

fd_eqvoc_proof_t *
fd_eqvoc_proof_t *
fd_eqvoc_proof_insert( fd_eqvoc_t * eqvoc, fd_gossip_duplicate_shred_t const * ds ) {
fd_slot_pubkey_t key = { ds->slot, ds->from };
fd_eqvoc_proof_t * proof = fd_eqvoc_proof_map_ele_query( eqvoc->proof_map, &key, NULL, eqvoc->proof_pool );
Expand All @@ -104,7 +104,7 @@ fd_eqvoc_fec_insert( fd_eqvoc_t * eqvoc, fd_shred_t const * shred ) {
fd_slot_fec_t key = { shred->slot, shred->fec_set_idx };
fd_eqvoc_fec_t * fec = fd_eqvoc_fec_map_ele_query( eqvoc->fec_map, &key, NULL, eqvoc->fec_pool );
if( FD_UNLIKELY( !fec ) ) {

/* TODO eviction logic */

fec = fd_eqvoc_fec_pool_ele_acquire( eqvoc->fec_pool );
Expand Down Expand Up @@ -170,7 +170,7 @@ fd_eqvoc_fec_search( fd_eqvoc_t const * eqvoc, fd_shred_t const * shred ) {
return NULL; /* No conflicts */
}

int
static int
shred_merkle_root( fd_eqvoc_t const * eqvoc, fd_shred_t const * shred, fd_bmtree_node_t * root_out ) {
fd_bmtree_commit_t * tree = fd_bmtree_commit_init( eqvoc->bmtree_mem,
FD_SHRED_MERKLE_NODE_SZ,
Expand Down
2 changes: 1 addition & 1 deletion src/choreo/tower/fd_tower.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ lockout_expiration_slot( fd_tower_vote_t const * vote ) {
return vote->slot + lockout;
}

void
static void
print( fd_tower_vote_t * tower_votes, ulong root ) {
ulong max_slot = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/disco/geyser/Local.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ifdef FD_HAS_INT128
$(call add-hdrs,fd_geyser.h)
$(call add-objs,fd_geyser,fd_disco)
$(call make-unit-test,test_geyser,test_geyser,fd_reedsol fd_disco fd_flamenco fd_ballet fd_funk fd_shred fd_tango fd_choreo fd_waltz fd_util)
$(call make-unit-test,test_geyser,test_geyser,fd_reedsol fd_disco fd_flamenco fd_ballet fd_funk fd_tango fd_choreo fd_waltz fd_util)
endif
4 changes: 1 addition & 3 deletions src/disco/gui/fd_gui.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
#include "fd_gui.h"
#include "fd_gui_printf.h"

#include "../fd_disco.h"
#include "../metrics/fd_metrics.h"
#include "../plugin/fd_plugin.h"

#include "../../ballet/base58/fd_base58.h"
#include "../../ballet/json/cJSON.h"

#include "../../app/fdctl/config.h"

FD_FN_CONST ulong
fd_gui_align( void ) {
return 128UL;
Expand Down
2 changes: 1 addition & 1 deletion src/flamenco/capture/Local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ifdef FD_HAS_INT128
ifdef FD_HAS_HOSTED
$(call add-objs,fd_solcap_writer fd_solcap_reader fd_solcap.pb,fd_flamenco)
$(call make-bin,fd_solcap_diff,fd_solcap_diff,fd_flamenco fd_ballet fd_util)
$(call make-bin,fd_solcap_import,fd_solcap_import,fd_flamenco fd_cjson fd_ballet fd_util)
$(call make-bin,fd_solcap_import,fd_solcap_import,fd_flamenco fd_ballet fd_util)
$(call make-bin,fd_solcap_yaml,fd_solcap_yaml,fd_flamenco fd_ballet fd_util)
$(call make-bin,fd_solcap_dump,fd_solcap_dump,fd_flamenco fd_ballet fd_util)
else
Expand Down
98 changes: 49 additions & 49 deletions src/flamenco/rewards/fd_rewards.c

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/flamenco/runtime/fd_executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ FD_SCRATCH_SCOPE_BEGIN {
} FD_SCRATCH_SCOPE_END;
}

int
static int
check_rent_transition( fd_borrowed_account_t * account, fd_rent_t const * rent, ulong fee ) {
ulong min_balance = fd_rent_exempt_minimum_balance( rent, account->const_meta->dlen );
ulong pre_lamports = account->const_meta->info.lamports;
Expand Down Expand Up @@ -464,16 +464,16 @@ fd_executor_load_transaction_accounts( fd_exec_txn_ctx_t * txn_ctx ) {
}
}

/* If it is not in the loaded program cache. Only accounts in the transaction
account keys that are owned by one of the four loaders (bpf v1, v2, v3, v4)
/* If it is not in the loaded program cache. Only accounts in the transaction
account keys that are owned by one of the four loaders (bpf v1, v2, v3, v4)
are iterated over in Agave's replenish_program_cache() function to be loaded
into the program cache. If we reach this far in the code path, then this
into the program cache. If we reach this far in the code path, then this
account should be in the program cache iff the owners match one of the four loaders
since `filter_executable_program_accounts()` filters out all other accounts here:
https://github.com/anza-xyz/agave/blob/v2.1/svm/src/transaction_processor.rs#L530-L560
Note that although the v4 loader is not yet activated, Agave still checks that the
owner matches one of the four bpf loaders provided in the hyperlink below
Note that although the v4 loader is not yet activated, Agave still checks that the
owner matches one of the four bpf loaders provided in the hyperlink below
within `filter_executable_program_accounts()`:
https://github.com/anza-xyz/agave/blob/v2.1/sdk/account/src/lib.rs#L800-L806 */
if( FD_UNLIKELY( ( memcmp( program_account->const_meta->info.owner, fd_solana_bpf_loader_deprecated_program_id.key, sizeof(fd_pubkey_t) ) &&
Expand Down Expand Up @@ -1279,7 +1279,7 @@ fd_executor_setup_borrowed_accounts_for_txn( fd_exec_txn_ctx_t * txn_ctx ) {

/* Create a borrowed account for all writable accounts and the fee payer
account which is almost always writable, but doesn't have to be.
TODO: The borrowed account semantics should better match Agave's. */
if( fd_txn_account_is_writable_idx( txn_ctx, (int)i ) || i==FD_FEE_PAYER_TXN_IDX ) {
void * borrowed_account_data = fd_spad_alloc( txn_ctx->spad, FD_ACCOUNT_REC_ALIGN, FD_ACC_TOT_SZ_MAX );
Expand Down Expand Up @@ -1785,7 +1785,7 @@ create_txn_context_protobuf_from_txn( fd_exec_test_txn_context_t * txn_context_m
* File name format is "txn-<base58_enc_sig>.bin"
*/
void
dump_txn_to_protobuf( fd_exec_txn_ctx_t *txn_ctx, fd_spad_t * spad ) {
fd_dump_txn_to_protobuf( fd_exec_txn_ctx_t *txn_ctx, fd_spad_t * spad ) {
FD_SCRATCH_SCOPE_BEGIN {
// Get base58-encoded tx signature
const fd_ed25519_sig_t * signatures = fd_txn_get_signatures( txn_ctx->txn_descriptor, txn_ctx->_txn_raw->raw );
Expand Down
10 changes: 5 additions & 5 deletions src/flamenco/runtime/fd_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ get_transaction_account_lock_limit( fd_exec_slot_ctx_t const * slot_ctx ) {
return fd_ulong_if( FD_FEATURE_ACTIVE( slot_ctx, increase_tx_account_lock_limit ), MAX_TX_ACCOUNT_LOCKS, 64UL );
}

/* Create an InstrContext protobuf struct from a given
transaction context and instr info.
/* Create an InstrContext protobuf struct from a given
transaction context and instr info.
NOTE: Calling this function requires the caller to have a scratch
NOTE: Calling this function requires the caller to have a scratch
frame ready and pushed (see dump_instr_to_protobuf) */
void
fd_create_instr_context_protobuf_from_instructions( fd_exec_test_instr_context_t * instr_context,
Expand Down Expand Up @@ -122,7 +122,7 @@ fd_executor_is_system_nonce_account( fd_borrowed_account_t * account );
*/

int
fd_executor_txn_check( fd_exec_slot_ctx_t const * slot_ctx,
fd_executor_txn_check( fd_exec_slot_ctx_t const * slot_ctx,
fd_exec_txn_ctx_t * txn );

void
Expand Down Expand Up @@ -161,7 +161,7 @@ fd_exec_consume_cus( fd_exec_txn_ctx_t * txn_ctx,
}

void
dump_txn_to_protobuf( fd_exec_txn_ctx_t *txn_ctx, fd_spad_t * spad );
fd_dump_txn_to_protobuf( fd_exec_txn_ctx_t *txn_ctx, fd_spad_t * spad );

/* We expose these only for the fuzzing harness.
Normally you shouldn't be invoking these manually. */
Expand Down
52 changes: 27 additions & 25 deletions src/flamenco/runtime/fd_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ fd_txn_prep_and_exec_task( void *tpool,
/* It is important to note that there is currently a 1-1 mapping between the
tiles and tpool threads at the time of this comment. Eventually, this will
change and the transaction context's spad will not be queried by tile
index as every tile will correspond to one CPU core. */
index as every tile will correspond to one CPU core. */
ulong tile_idx = fd_tile_idx();
task_info->txn_ctx->spad = task_info->spads[ tile_idx ];
if( FD_UNLIKELY( !task_info->txn_ctx->spad ) ) {
Expand Down Expand Up @@ -2146,7 +2146,7 @@ fd_runtime_execute_txns_in_waves_tpool( fd_exec_slot_ctx_t * slot_ctx,
// Dump txns in waves
if( dump_txn ) {
for( ulong i = 0; i < wave_task_infos_cnt; ++i ) {
dump_txn_to_protobuf( wave_task_infos[i].txn_ctx, spads[0] );
fd_dump_txn_to_protobuf( wave_task_infos[i].txn_ctx, spads[0] );
}
}

Expand Down Expand Up @@ -2336,7 +2336,7 @@ fd_runtime_block_execute_finalize_tpool( fd_exec_slot_ctx_t * slot_ctx,
return FD_RUNTIME_EXECUTE_SUCCESS;
}

int
int
fd_runtime_block_execute_tpool_v2( fd_exec_slot_ctx_t * slot_ctx,
fd_capture_ctx_t * capture_ctx,
fd_block_info_t const * block_info,
Expand Down Expand Up @@ -3001,8 +3001,10 @@ fd_runtime_txn_lamports_per_signature( fd_exec_txn_ctx_t * txn_ctx,
return (txn_raw == NULL) ? fd_runtime_lamports_per_signature_for_blockhash(txn_ctx->slot_ctx, NULL) : fd_runtime_lamports_per_signature_for_blockhash(txn_ctx->slot_ctx, (fd_hash_t *)((uchar *)txn_raw->raw + txn_descriptor->recent_blockhash_off));
}

void compute_priority_fee(fd_exec_txn_ctx_t const *txn_ctx, ulong *fee, ulong *priority)
{
static void
compute_priority_fee( fd_exec_txn_ctx_t const * txn_ctx,
ulong * fee,
ulong * priority ) {
switch (txn_ctx->prioritization_fee_type)
{
case FD_COMPUTE_BUDGET_PRIORITIZATION_FEE_TYPE_DEPRECATED:
Expand Down Expand Up @@ -4106,7 +4108,7 @@ void fd_update_next_epoch_stakes( fd_exec_slot_ctx_t * slot_ctx ) {
From the calling context, `out_rec` points to a native program record (e.g. Config, ALUT native programs).
There should be enough space in `out_rec->data` to hold at least 36 bytes (the size of a BPF upgradeable
program account) when calling this function. The native program account's owner is set to the BPF loader
program account) when calling this function. The native program account's owner is set to the BPF loader
upgradeable program ID, and lamports are increased / deducted to contain the rent exempt minimum balance.
https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/core_bpf_migration/mod.rs#L79-L95 */
Expand Down Expand Up @@ -4178,7 +4180,7 @@ fd_new_target_program_data_account( fd_exec_slot_ctx_t * slot_ctx,

/* https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/core_bpf_migration/mod.rs#L118-L125 */
if( config_upgrade_authority_address!=NULL ) {
if( FD_UNLIKELY( state.inner.buffer.authority_address==NULL ||
if( FD_UNLIKELY( state.inner.buffer.authority_address==NULL ||
memcmp( config_upgrade_authority_address, state.inner.buffer.authority_address, sizeof(fd_pubkey_t) ) ) ) {
return -1;
}
Expand Down Expand Up @@ -4230,7 +4232,7 @@ fd_new_target_program_data_account( fd_exec_slot_ctx_t * slot_ctx,
- source_buffer_address: source_buffer_address
- migration_target
- Builtin: !stateless
- Stateless: stateless
- Stateless: stateless
- upgrade_authority_address: upgrade_authority_address
https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/core_bpf_migration/mod.rs#L235-L318 */
static void
Expand All @@ -4242,12 +4244,12 @@ fd_migrate_builtin_to_core_bpf( fd_exec_slot_ctx_t * slot_ctx,
int err;

/* https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/core_bpf_migration/mod.rs#L242-L243
The below logic is used to obtain a `TargetBuiltin` account. There are three fields of `TargetBuiltin` returned:
- target.program_address: builtin_program_id
- target.program_account:
- target.program_address: builtin_program_id
- target.program_account:
- if stateless: an AccountSharedData::default() (i.e. system program id, 0 lamports, 0 data, non-executable, system program owner)
- if NOT stateless: the existing account (for us its called `target_program_account`)
- if NOT stateless: the existing account (for us its called `target_program_account`)
- target.program_data_address: `target_program_data_address` for us, derived below. */

/* These checks will fail if the core program has already been migrated to BPF, since the account will exist + the program owner
Expand Down Expand Up @@ -4298,8 +4300,8 @@ fd_migrate_builtin_to_core_bpf( fd_exec_slot_ctx_t * slot_ctx,
return;
}

/* https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/core_bpf_migration/mod.rs#L244
/* https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/core_bpf_migration/mod.rs#L244
Obtains a `SourceBuffer` account. There are two fields returned:
- source.buffer_address: source_buffer_address
- source.buffer_account: the existing buffer account */
Expand Down Expand Up @@ -4352,15 +4354,15 @@ fd_migrate_builtin_to_core_bpf( fd_exec_slot_ctx_t * slot_ctx,
FD_LOG_WARNING(( "Failed to write new program state to %s", FD_BASE58_ENC_32_ALLOCA( builtin_program_id ) ));
goto fail;
}

/* Create a new target program data account. */
ulong new_target_program_data_account_sz = PROGRAMDATA_METADATA_SIZE - BUFFER_METADATA_SIZE + source_buffer_account->const_meta->dlen;
FD_BORROWED_ACCOUNT_DECL( new_target_program_data_account );
err = fd_acc_mgr_modify( slot_ctx->acc_mgr,
slot_ctx->funk_txn,
target_program_data_address,
1,
new_target_program_data_account_sz,
err = fd_acc_mgr_modify( slot_ctx->acc_mgr,
slot_ctx->funk_txn,
target_program_data_address,
1,
new_target_program_data_account_sz,
new_target_program_data_account );
if( FD_UNLIKELY( err ) ) {
FD_LOG_WARNING(( "Failed to create new program data account to %s", FD_BASE58_ENC_32_ALLOCA( target_program_data_address ) ));
Expand All @@ -4375,9 +4377,9 @@ fd_migrate_builtin_to_core_bpf( fd_exec_slot_ctx_t * slot_ctx,
goto fail;
}

/* Deploy the new target Core BPF program.
/* Deploy the new target Core BPF program.
https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/core_bpf_migration/mod.rs#L268-L271 */
err = fd_directly_invoke_loader_v3_deploy( slot_ctx,
err = fd_directly_invoke_loader_v3_deploy( slot_ctx,
new_target_program_data_account->const_data + PROGRAMDATA_METADATA_SIZE,
new_target_program_data_account->const_meta->dlen - PROGRAMDATA_METADATA_SIZE );
if( FD_UNLIKELY( err ) ) {
Expand All @@ -4396,15 +4398,15 @@ fd_migrate_builtin_to_core_bpf( fd_exec_slot_ctx_t * slot_ctx,
slot_ctx->slot_bank.capitalization += lamports_to_fund - lamports_to_burn;
}

/* Reclaim the source buffer account
/* Reclaim the source buffer account
https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/core_bpf_migration/mod.rs#L305 */
source_buffer_account->meta->info.lamports = 0;
source_buffer_account->meta->dlen = 0;
fd_memset( source_buffer_account->meta->info.owner, 0, sizeof(fd_pubkey_t) );

/* Publish the in-preparation transaction into the parent. We should not have to create
a BPF cache entry here because the program is technically "delayed visibility", so the program
should not be invokable until the next slot. The cache entry will be created at the end of the
should not be invokable until the next slot. The cache entry will be created at the end of the
block as a part of the finalize routine. */
fd_funk_txn_publish_into_parent( slot_ctx->acc_mgr->funk, slot_ctx->funk_txn, 1 );
slot_ctx->funk_txn = parent_txn;
Expand Down
Loading

0 comments on commit 31288d7

Please sign in to comment.