LCOV - code coverage report
Current view: top level - flamenco/runtime/program - fd_builtin_programs.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 111 0.0 %
Date: 2025-12-04 04:56:06 Functions: 0 12 0.0 %

          Line data    Source code
       1             : #include "fd_builtin_programs.h"
       2             : #include "fd_precompiles.h"
       3             : #include "../fd_system_ids.h"
       4             : #include "../fd_system_ids_pp.h"
       5             : #include "../../accdb/fd_accdb_impl_v1.h"
       6             : 
       7             : #define BUILTIN_PROGRAM(program_id, name, feature_offset, migration_config) \
       8             :     {                                                                       \
       9             :         program_id,                                                         \
      10             :         name,                                                               \
      11             :         feature_offset,                                                     \
      12             :         migration_config                                                    \
      13             :     }
      14             : 
      15             : #define STATELESS_BUILTIN(program_id, migration_config) \
      16             :     {                                                   \
      17             :         program_id,                                     \
      18             :         migration_config                                \
      19             :     }
      20             : 
      21             : #define CORE_BPF_MIGRATION_CONFIG(source_buffer_address, upgrade_authority_address, enable_feature_offset, builtin_program_id) \
      22             :     {                                                                                                                          \
      23             :         source_buffer_address,                                                                                                 \
      24             :         upgrade_authority_address,                                                                                             \
      25             :         enable_feature_offset,                                                                                                 \
      26             :         builtin_program_id                                                                                                     \
      27             :     }
      28             : 
      29             : #define PRECOMPILE(program_id, feature_offset, verify_fn) \
      30             :     {                                                     \
      31             :         program_id,                                       \
      32             :         feature_offset,                                   \
      33             :         verify_fn                                         \
      34             :     }
      35             : 
      36             : /* Core BPF migration configs */
      37             : static const fd_core_bpf_migration_config_t BUILTIN_TO_CORE_BPF_STAKE_PROGRAM_CONFIG = {
      38             :     &fd_solana_stake_program_buffer_address,
      39             :     NULL,
      40             :     offsetof(fd_features_t, migrate_stake_program_to_core_bpf),
      41             :     FD_CORE_BPF_MIGRATION_TARGET_BUILTIN,
      42             :     &fd_solana_stake_program_id,
      43             :     NULL
      44             : };
      45             : static const fd_core_bpf_migration_config_t * const MIGRATE_BUILTIN_TO_CORE_BPF_STAKE_PROGRAM_CONFIG = &BUILTIN_TO_CORE_BPF_STAKE_PROGRAM_CONFIG;
      46             : 
      47             : static const fd_core_bpf_migration_config_t BUILTIN_TO_CORE_BPF_CONFIG_PROGRAM_CONFIG = {
      48             :     &fd_solana_config_program_buffer_address,
      49             :     NULL,
      50             :     offsetof(fd_features_t, migrate_config_program_to_core_bpf),
      51             :     FD_CORE_BPF_MIGRATION_TARGET_BUILTIN,
      52             :     &fd_solana_config_program_id,
      53             :     NULL
      54             : };
      55             : static const fd_core_bpf_migration_config_t * const MIGRATE_BUILTIN_TO_CORE_BPF_CONFIG_PROGRAM_CONFIG = &BUILTIN_TO_CORE_BPF_CONFIG_PROGRAM_CONFIG;
      56             : 
      57             : static const fd_core_bpf_migration_config_t BUILTIN_TO_CORE_BPF_ADDRESS_LOOKUP_TABLE_PROGRAM_CONFIG = {
      58             :     &fd_solana_address_lookup_table_program_buffer_address,
      59             :     NULL,
      60             :     offsetof(fd_features_t, migrate_address_lookup_table_program_to_core_bpf),
      61             :     FD_CORE_BPF_MIGRATION_TARGET_BUILTIN,
      62             :     &fd_solana_address_lookup_table_program_id,
      63             :     NULL
      64             : };
      65             : static const fd_core_bpf_migration_config_t * const MIGRATE_BUILTIN_TO_CORE_BPF_ADDRESS_LOOKUP_TABLE_PROGRAM_CONFIG = &BUILTIN_TO_CORE_BPF_ADDRESS_LOOKUP_TABLE_PROGRAM_CONFIG;
      66             : 
      67             : static const fd_core_bpf_migration_config_t STATELESS_TO_CORE_BPF_FEATURE_GATE_PROGRAM_CONFIG = {
      68             :     &fd_solana_feature_program_buffer_address,
      69             :     NULL,
      70             :     offsetof(fd_features_t, migrate_feature_gate_program_to_core_bpf),
      71             :     FD_CORE_BPF_MIGRATION_TARGET_STATELESS,
      72             :     &fd_solana_feature_program_id,
      73             :     NULL
      74             : };
      75             : static const fd_core_bpf_migration_config_t * const MIGRATE_STATELESS_TO_CORE_BPF_FEATURE_GATE_PROGRAM_CONFIG = &STATELESS_TO_CORE_BPF_FEATURE_GATE_PROGRAM_CONFIG;
      76             : 
      77             : /* 192ed727334abe822d5accba8b886e25f88b03c76973c2e7290cfb55b9e1115f */
      78             : #define SLASHING_PROG_HASH_SIMD_204 0x19U,0x2eU,0xd7U,0x27U,0x33U,0x4aU,0xbeU,0x82U,0x2dU,0x5aU,0xccU,0xbaU,0x8bU,0x88U,0x6eU,0x25U, \
      79             :                                     0xf8U,0x8bU,0x03U,0xc7U,0x69U,0x73U,0xc2U,0xe7U,0x29U,0x0cU,0xfbU,0x55U,0xb9U,0xe1U,0x11U,0x5fU
      80             : const fd_hash_t fd_solana_slashing_program_verified_build_hash_simd_204 = { .uc = { SLASHING_PROG_HASH_SIMD_204 } };
      81             : static const fd_core_bpf_migration_config_t STATELESS_TO_CORE_BPF_SLASHING_PROGRAM_CONFIG = {
      82             :     &fd_solana_slashing_program_buffer_address,
      83             :     NULL,
      84             :     offsetof(fd_features_t, enshrine_slashing_program),
      85             :     FD_CORE_BPF_MIGRATION_TARGET_STATELESS,
      86             :     &fd_solana_slashing_program_id,
      87             :     &fd_solana_slashing_program_verified_build_hash_simd_204
      88             : };
      89             : static const fd_core_bpf_migration_config_t * const MIGRATE_STATELESS_TO_CORE_BPF_SLASHING_PROGRAM_CONFIG = &STATELESS_TO_CORE_BPF_SLASHING_PROGRAM_CONFIG;
      90             : 
      91             : #define SYSTEM_PROGRAM_BUILTIN                BUILTIN_PROGRAM(&fd_solana_system_program_id,                 "system_program",                        NO_ENABLE_FEATURE_ID,                                      NULL)
      92             : #define VOTE_PROGRAM_BUILTIN                  BUILTIN_PROGRAM(&fd_solana_vote_program_id,                   "vote_program",                          NO_ENABLE_FEATURE_ID,                                      NULL)
      93             : #define STAKE_PROGRAM_BUILTIN                 BUILTIN_PROGRAM(&fd_solana_stake_program_id,                  "stake_program",                         NO_ENABLE_FEATURE_ID,                                      MIGRATE_BUILTIN_TO_CORE_BPF_STAKE_PROGRAM_CONFIG)
      94             : #define CONFIG_PROGRAM_BUILTIN                BUILTIN_PROGRAM(&fd_solana_config_program_id,                 "config_program",                        NO_ENABLE_FEATURE_ID,                                      MIGRATE_BUILTIN_TO_CORE_BPF_CONFIG_PROGRAM_CONFIG)
      95             : #define LOADER_V4_BUILTIN                     BUILTIN_PROGRAM(&fd_solana_bpf_loader_v4_program_id,          "loader_v4",                             offsetof(fd_features_t, enable_loader_v4),                 NULL)
      96             : #define ADDRESS_LOOKUP_TABLE_PROGRAM_BUILTIN  BUILTIN_PROGRAM(&fd_solana_address_lookup_table_program_id,   "address_lookup_table_program",          NO_ENABLE_FEATURE_ID,                                      MIGRATE_BUILTIN_TO_CORE_BPF_ADDRESS_LOOKUP_TABLE_PROGRAM_CONFIG)
      97             : #define BPF_LOADER_DEPRECATED_BUILTIN         BUILTIN_PROGRAM(&fd_solana_bpf_loader_deprecated_program_id,  "solana_bpf_loader_deprecated_program",  NO_ENABLE_FEATURE_ID,                                      NULL)
      98             : #define BPF_LOADER_BUILTIN                    BUILTIN_PROGRAM(&fd_solana_bpf_loader_program_id,             "solana_bpf_loader_program",             NO_ENABLE_FEATURE_ID,                                      NULL)
      99             : #define BPF_LOADER_UPGRADEABLE_BUILTIN        BUILTIN_PROGRAM(&fd_solana_bpf_loader_upgradeable_program_id, "solana_bpf_loader_upgradeable_program", NO_ENABLE_FEATURE_ID,                                      NULL)
     100             : #define COMPUTE_BUDGET_PROGRAM_BUILTIN        BUILTIN_PROGRAM(&fd_solana_compute_budget_program_id,         "compute_budget_program",                NO_ENABLE_FEATURE_ID,                                      NULL)
     101             : #define ZK_TOKEN_PROOF_PROGRAM_BUILTIN        BUILTIN_PROGRAM(&fd_solana_zk_token_proof_program_id,         "zk_token_proof_program",                offsetof(fd_features_t, zk_token_sdk_enabled),             NULL)
     102             : #define ZK_ELGAMAL_PROOF_PROGRAM_BUILTIN      BUILTIN_PROGRAM(&fd_solana_zk_elgamal_proof_program_id,       "zk_elgamal_proof_program",              offsetof(fd_features_t, zk_elgamal_proof_program_enabled), NULL)
     103             : 
     104             : #define FEATURE_PROGRAM_BUILTIN               STATELESS_BUILTIN(&fd_solana_feature_program_id,  MIGRATE_STATELESS_TO_CORE_BPF_FEATURE_GATE_PROGRAM_CONFIG)
     105             : #define SLASHING_PROGRAM_BUILTIN              STATELESS_BUILTIN(&fd_solana_slashing_program_id, MIGRATE_STATELESS_TO_CORE_BPF_SLASHING_PROGRAM_CONFIG)
     106             : 
     107             : #define SECP256R1_PROGRAM_PRECOMPILE          PRECOMPILE(&fd_solana_secp256r1_program_id,          offsetof(fd_features_t, enable_secp256r1_precompile), fd_precompile_secp256r1_verify)
     108             : #define KECCAK_SECP_PROGRAM_PRECOMPILE        PRECOMPILE(&fd_solana_keccak_secp_256k_program_id,   NO_ENABLE_FEATURE_ID,                                 fd_precompile_secp256k1_verify)
     109             : #define ED25519_SV_PROGRAM_PRECOMPILE         PRECOMPILE(&fd_solana_ed25519_sig_verify_program_id, NO_ENABLE_FEATURE_ID,                                 fd_precompile_ed25519_verify)
     110             : 
     111             : /* https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/mod.rs#L133-L143 */
     112             : static const fd_stateless_builtin_program_t stateless_programs_builtins[] = {
     113             :     FEATURE_PROGRAM_BUILTIN,
     114             :     SLASHING_PROGRAM_BUILTIN
     115             : };
     116           0 : #define STATELESS_BUILTINS_COUNT (sizeof(stateless_programs_builtins) / sizeof(fd_stateless_builtin_program_t))
     117             : 
     118             : static const fd_precompile_program_t precompiles[] = {
     119             :     SECP256R1_PROGRAM_PRECOMPILE,
     120             :     KECCAK_SECP_PROGRAM_PRECOMPILE,
     121             :     ED25519_SV_PROGRAM_PRECOMPILE
     122             : };
     123           0 : #define PRECOMPILE_PROGRAMS_COUNT (sizeof(precompiles) / sizeof(fd_precompile_program_t))
     124             : 
     125             : /* https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/mod.rs#L34-L131 */
     126             : static fd_builtin_program_t const builtin_programs[] = {
     127             :     SYSTEM_PROGRAM_BUILTIN,
     128             :     VOTE_PROGRAM_BUILTIN,
     129             :     STAKE_PROGRAM_BUILTIN,
     130             :     CONFIG_PROGRAM_BUILTIN,
     131             :     LOADER_V4_BUILTIN,
     132             :     ADDRESS_LOOKUP_TABLE_PROGRAM_BUILTIN,
     133             :     BPF_LOADER_DEPRECATED_BUILTIN,
     134             :     BPF_LOADER_BUILTIN,
     135             :     BPF_LOADER_UPGRADEABLE_BUILTIN,
     136             :     COMPUTE_BUDGET_PROGRAM_BUILTIN,
     137             :     ZK_TOKEN_PROOF_PROGRAM_BUILTIN,
     138             :     ZK_ELGAMAL_PROOF_PROGRAM_BUILTIN
     139             : };
     140           0 : #define BUILTIN_PROGRAMS_COUNT (sizeof(builtin_programs) / sizeof(fd_builtin_program_t))
     141             : 
     142             : /* Used by the compute budget program to determine how many CUs to deduct by default
     143             :    https://github.com/anza-xyz/agave/blob/v2.1.13/builtins-default-costs/src/lib.rs#L113-L139 */
     144             : static fd_core_bpf_migration_config_t const * migrating_builtins[] = {
     145             :     MIGRATE_BUILTIN_TO_CORE_BPF_STAKE_PROGRAM_CONFIG,
     146             :     MIGRATE_BUILTIN_TO_CORE_BPF_CONFIG_PROGRAM_CONFIG,
     147             :     MIGRATE_BUILTIN_TO_CORE_BPF_ADDRESS_LOOKUP_TABLE_PROGRAM_CONFIG,
     148             : };
     149           0 : #define MIGRATING_BUILTINS_COUNT (sizeof(migrating_builtins) / sizeof(fd_core_bpf_migration_config_t const *))
     150             : 
     151             : /* https://github.com/anza-xyz/agave/blob/v2.1.13/builtins-default-costs/src/lib.rs#L141-L193 */
     152             : #define MAP_PERFECT_NAME fd_non_migrating_builtins_tbl
     153             : #define MAP_PERFECT_LG_TBL_SZ 4
     154             : #define MAP_PERFECT_T fd_pubkey_t
     155           0 : #define MAP_PERFECT_HASH_C 146U
     156             : #define MAP_PERFECT_KEY uc
     157             : #define MAP_PERFECT_KEY_T fd_pubkey_t const *
     158             : #define MAP_PERFECT_ZERO_KEY  (0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0)
     159             : #define MAP_PERFECT_COMPLEX_KEY 1
     160           0 : #define MAP_PERFECT_KEYS_EQUAL(k1,k2) (!memcmp( (k1), (k2), 32UL ))
     161             : 
     162           0 : #define PERFECT_HASH( u ) (((MAP_PERFECT_HASH_C*(u))>>28)&0x0FU)
     163             : 
     164             : #define MAP_PERFECT_HASH_PP( a00,a01,a02,a03,a04,a05,a06,a07,a08,a09,a10,a11,a12,a13,a14,a15, \
     165             :                              a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31) \
     166             :                                           PERFECT_HASH( (a08 | (a09<<8) | (a10<<16) | (a11<<24)) )
     167           0 : #define MAP_PERFECT_HASH_R( ptr ) PERFECT_HASH( fd_uint_load_4( (uchar const *)ptr->uc + 8UL ) )
     168             : 
     169             : #define MAP_PERFECT_0      ( VOTE_PROG_ID            ),
     170             : #define MAP_PERFECT_1      ( SYS_PROG_ID             ),
     171             : #define MAP_PERFECT_2      ( COMPUTE_BUDGET_PROG_ID  ),
     172             : #define MAP_PERFECT_3      ( BPF_UPGRADEABLE_PROG_ID ),
     173             : #define MAP_PERFECT_4      ( BPF_LOADER_1_PROG_ID    ),
     174             : #define MAP_PERFECT_5      ( BPF_LOADER_2_PROG_ID    ),
     175             : #define MAP_PERFECT_6      ( LOADER_V4_PROG_ID       ),
     176             : #define MAP_PERFECT_7      ( KECCAK_SECP_PROG_ID     ),
     177             : #define MAP_PERFECT_8      ( ED25519_SV_PROG_ID      ),
     178             : 
     179             : #include "../../../util/tmpl/fd_map_perfect.c"
     180             : #undef PERFECT_HASH
     181             : 
     182             : // https://github.com/anza-xyz/agave/blob/v2.3.7/runtime/src/bank.rs#L4944
     183             : static int
     184             : fd_builtin_is_bpf( fd_funk_t *               funk,
     185             :                    fd_funk_txn_xid_t const * xid,
     186           0 :                    fd_pubkey_t const  *      pubkey ) {
     187           0 :   fd_txn_account_t rec[1];
     188           0 :   int err = fd_txn_account_init_from_funk_readonly( rec, pubkey, funk, xid );
     189           0 :   if( !!err ) {
     190           0 :     return 0;
     191           0 :   }
     192             : 
     193           0 :   fd_pubkey_t const * owner = fd_txn_account_get_owner( rec );
     194           0 :   return memcmp( owner, &fd_solana_bpf_loader_upgradeable_program_id, sizeof(fd_solana_bpf_loader_upgradeable_program_id) )==0;
     195           0 : }
     196             : 
     197             : 
     198             : /* BuiltIn programs need "bogus" executable accounts to exist.
     199             :    These are loaded and ignored during execution.
     200             : 
     201             :    Bogus accounts are marked as "executable", but their data is a
     202             :    hardcoded ASCII string. */
     203             : 
     204             : /* https://github.com/solana-labs/solana/blob/8f2c8b8388a495d2728909e30460aa40dcc5d733/sdk/src/native_loader.rs#L19 */
     205             : void
     206             : fd_write_builtin_account( fd_bank_t  *              bank,
     207             :                           fd_accdb_user_t *         accdb,
     208             :                           fd_funk_txn_xid_t const * xid,
     209             :                           fd_capture_ctx_t *        capture_ctx,
     210             :                           fd_pubkey_t const         pubkey,
     211             :                           char const *              data,
     212           0 :                           ulong                     sz ) {
     213             : 
     214           0 :   fd_txn_account_t rec[1];
     215           0 :   fd_funk_rec_prepare_t prepare = {0};
     216             : 
     217           0 :   int ok = !!fd_txn_account_init_from_funk_mutable( rec, &pubkey, accdb, xid, 1, sz, &prepare );
     218           0 :   FD_TEST( ok );
     219             : 
     220           0 :   fd_lthash_value_t prev_hash[1];
     221           0 :   fd_hashes_account_lthash(
     222           0 :     &pubkey,
     223           0 :     fd_txn_account_get_meta( rec ),
     224           0 :     fd_txn_account_get_data( rec ),
     225           0 :     prev_hash );
     226             : 
     227           0 :   fd_txn_account_set_data( rec, data, sz );
     228           0 :   fd_txn_account_set_lamports( rec, 1UL );
     229           0 :   fd_txn_account_set_executable( rec, 1 );
     230           0 :   fd_txn_account_set_owner( rec, &fd_solana_native_loader_id );
     231             : 
     232           0 :   fd_hashes_update_lthash( rec, prev_hash, bank, capture_ctx );
     233             : 
     234           0 :   fd_txn_account_mutable_fini( rec, accdb, &prepare );
     235             : 
     236           0 :   fd_bank_capitalization_set( bank, fd_bank_capitalization_get( bank ) + 1UL );
     237           0 : }
     238             : 
     239             : /* https://github.com/solana-labs/solana/blob/8f2c8b8388a495d2728909e30460aa40dcc5d733/runtime/src/inline_spl_token.rs#L74 */
     240             : /* TODO: move this somewhere more appropiate */
     241             : static void
     242             : write_inline_spl_native_mint_program_account( fd_accdb_user_t *         accdb,
     243           0 :                                               fd_funk_txn_xid_t const * xid ) {
     244             : 
     245           0 :   if( true ) {
     246             :     /* FIXME: This is a hack that corresponds to the cluster type field
     247             :        in Agave. This needs to get implemented properly in Firedancer. */
     248           0 :     return;
     249           0 :   }
     250             : 
     251           0 :   fd_pubkey_t const * key  = (fd_pubkey_t const *)&fd_solana_spl_native_mint_id;
     252           0 :   fd_txn_account_t rec[1];
     253             : 
     254             :   /* https://github.com/solana-labs/solana/blob/8f2c8b8388a495d2728909e30460aa40dcc5d733/runtime/src/inline_spl_token.rs#L86-L90 */
     255           0 :   static uchar const data[] = {
     256           0 :       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     257           0 :       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     258           0 :       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
     259             : 
     260           0 :   fd_funk_rec_prepare_t prepare = {0};
     261           0 :   int ok = !!fd_txn_account_init_from_funk_mutable( rec, key, accdb, xid, 1, sizeof(data), &prepare );
     262           0 :   FD_TEST( ok );
     263             : 
     264           0 :   fd_txn_account_set_lamports( rec, 1000000000UL );
     265           0 :   fd_txn_account_set_executable( rec, 0 );
     266           0 :   fd_txn_account_set_owner( rec, &fd_solana_spl_token_id );
     267           0 :   fd_txn_account_set_data( rec, data, sizeof(data) );
     268             : 
     269           0 :   fd_txn_account_mutable_fini( rec, accdb, &prepare );
     270           0 : }
     271             : 
     272             : // <rant> Why are these not in the genesis block themselves?! the hackery to deal with subtle solana variants
     273             : //        because of the "special knowledge" required for these accounts is counter productive... </rant>
     274             : 
     275             : void
     276             : fd_builtin_programs_init( fd_bank_t *               bank,
     277             :                           fd_accdb_user_t *         accdb,
     278             :                           fd_funk_txn_xid_t const * xid,
     279           0 :                           fd_capture_ctx_t *        capture_ctx ) {
     280             :   /* https://github.com/anza-xyz/agave/blob/v2.3.7/builtins/src/lib.rs#L52 */
     281           0 :   fd_builtin_program_t const * builtins = fd_builtins();
     282             : 
     283           0 :   fd_funk_t * funk = fd_accdb_user_v1_funk( accdb );
     284           0 :   for( ulong i=0UL; i<fd_num_builtins(); i++ ) {
     285             :     /** https://github.com/anza-xyz/agave/blob/v2.3.7/runtime/src/bank.rs#L4949 */
     286           0 :     if( fd_bank_slot_get( bank )==0UL && builtins[i].enable_feature_offset==NO_ENABLE_FEATURE_ID && !fd_builtin_is_bpf( funk, xid, builtins[i].pubkey ) ) {
     287           0 :       fd_write_builtin_account( bank, accdb, xid, capture_ctx, *builtins[i].pubkey, builtins[i].data, strlen( builtins[i].data ) );
     288           0 :     } else if( builtins[i].core_bpf_migration_config && FD_FEATURE_ACTIVE_OFFSET( fd_bank_slot_get( bank ), fd_bank_features_query( bank ), builtins[i].core_bpf_migration_config->enable_feature_offset ) ) {
     289           0 :       continue;
     290           0 :     } else if( builtins[i].enable_feature_offset!=NO_ENABLE_FEATURE_ID && !FD_FEATURE_ACTIVE_OFFSET( fd_bank_slot_get( bank ), fd_bank_features_query( bank ), builtins[i].enable_feature_offset ) ) {
     291           0 :       continue;
     292           0 :     } else {
     293           0 :       fd_write_builtin_account( bank, accdb, xid, capture_ctx, *builtins[i].pubkey, builtins[i].data, strlen(builtins[i].data) );
     294           0 :     }
     295           0 :   }
     296             : 
     297             :   /* Precompiles have empty account data */
     298           0 :   fd_write_builtin_account( bank, accdb, xid, capture_ctx, fd_solana_keccak_secp_256k_program_id, "", 0 );
     299           0 :   fd_write_builtin_account( bank, accdb, xid, capture_ctx, fd_solana_ed25519_sig_verify_program_id, "", 0 );
     300           0 :   if( FD_FEATURE_ACTIVE_BANK( bank, enable_secp256r1_precompile ) ) {
     301           0 :     fd_write_builtin_account( bank, accdb, xid, capture_ctx, fd_solana_secp256r1_program_id, "", 0 );
     302           0 :   }
     303             : 
     304             :   /* Inline SPL token mint program ("inlined to avoid an external dependency on the spl-token crate") */
     305           0 :   write_inline_spl_native_mint_program_account( accdb, xid );
     306           0 : }
     307             : 
     308             : fd_builtin_program_t const *
     309           0 : fd_builtins( void ) {
     310           0 :   return builtin_programs;
     311           0 : }
     312             : 
     313             : ulong
     314           0 : fd_num_builtins( void ) {
     315           0 :   return BUILTIN_PROGRAMS_COUNT;
     316           0 : }
     317             : 
     318             : fd_stateless_builtin_program_t const *
     319           0 : fd_stateless_builtins( void ) {
     320           0 :   return stateless_programs_builtins;
     321           0 : }
     322             : 
     323             : ulong
     324           0 : fd_num_stateless_builtins( void ) {
     325           0 :   return STATELESS_BUILTINS_COUNT;
     326           0 : }
     327             : 
     328             : fd_precompile_program_t const *
     329           0 : fd_precompiles( void ) {
     330           0 :   return precompiles;
     331           0 : }
     332             : 
     333             : ulong
     334           0 : fd_num_precompiles( void ) {
     335           0 :   return PRECOMPILE_PROGRAMS_COUNT;
     336           0 : }
     337             : 
     338             : uchar
     339             : fd_is_migrating_builtin_program( fd_bank_t *         bank,
     340             :                                  fd_pubkey_t const * pubkey,
     341           0 :                                  uchar *             migrated_yet ) {
     342           0 :   *migrated_yet = 0;
     343             : 
     344           0 :   for( ulong i=0; i<MIGRATING_BUILTINS_COUNT; i++ ) {
     345           0 :     fd_core_bpf_migration_config_t const * config = migrating_builtins[i];
     346           0 :     if( !memcmp( pubkey->uc, config->builtin_program_id->key, sizeof(fd_pubkey_t) ) ) {
     347           0 :       if( config->enable_feature_offset!=NO_ENABLE_FEATURE_ID &&
     348           0 :         FD_FEATURE_ACTIVE_OFFSET( fd_bank_slot_get( bank ), fd_bank_features_query( bank ), config->enable_feature_offset ) ) {
     349             :         /* The program has been migrated to BPF. */
     350           0 :         *migrated_yet = 1;
     351           0 :       }
     352             : 
     353           0 :       return 1;
     354           0 :     }
     355           0 :   }
     356             : 
     357             :   /* No migration config exists for this program */
     358           0 :   return 0;
     359           0 : }
     360             : 
     361             : FD_FN_PURE uchar
     362           0 : fd_is_non_migrating_builtin_program( fd_pubkey_t const * pubkey ) {
     363           0 :   return !!( fd_non_migrating_builtins_tbl_contains( pubkey ) );
     364           0 : }

Generated by: LCOV version 1.14