LCOV - code coverage report
Current view: top level - flamenco/runtime/program - fd_builtin_programs.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 2 0.0 %
Date: 2025-10-13 04:42:14 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_runtime_program_fd_buildin_programs_h
       2             : #define HEADER_fd_src_flamenco_runtime_program_fd_buildin_programs_h
       3             : 
       4             : #include "../../fd_flamenco_base.h"
       5             : #include "../fd_bank.h"
       6             : #include "../fd_system_ids_pp.h"
       7             : 
       8           0 : #define NO_ENABLE_FEATURE_ID ULONG_MAX
       9             : #define FD_CORE_BPF_MIGRATION_TARGET_BUILTIN   (0)
      10           0 : #define FD_CORE_BPF_MIGRATION_TARGET_STATELESS (1)
      11             : 
      12             : /* https://github.com/anza-xyz/agave/blob/v2.3.0/builtins/src/core_bpf_migration.rs#L17-L43
      13             :    Configuration for migrating a built-in program to Core BPF.
      14             :    - `migration_target` is one of
      15             :       FD_CORE_BPF_MIGRATION_TARGET_{BUILTIN,STATELESS}. */
      16             : struct fd_core_bpf_migration_config {
      17             :   fd_pubkey_t const * source_buffer_address;
      18             :   fd_pubkey_t *       upgrade_authority_address;
      19             :   ulong               enable_feature_offset;
      20             :   uchar               migration_target;
      21             :   fd_pubkey_t const * builtin_program_id;
      22             :   fd_hash_t const *   verified_build_hash;
      23             : };
      24             : typedef struct fd_core_bpf_migration_config fd_core_bpf_migration_config_t;
      25             : 
      26             : /* https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/prototypes.rs#L7-L13
      27             :    Transitions of built-in programs at epoch boundaries when features are activated */
      28             : struct fd_builtin_program {
      29             :   fd_pubkey_t const *                    pubkey;
      30             :   char const *                           data;
      31             :   ulong                                  enable_feature_offset;
      32             :   fd_core_bpf_migration_config_t const * core_bpf_migration_config;
      33             : };
      34             : typedef struct fd_builtin_program fd_builtin_program_t;
      35             : 
      36             : /* https://github.com/anza-xyz/agave/blob/v2.1.0/runtime/src/bank/builtins/prototypes.rs#L31-L35
      37             :    Transitions of stateless built-in programs at epoch boundaries when features are activated */
      38             : struct fd_stateless_builtin_program {
      39             :   fd_pubkey_t const *                    pubkey;
      40             :   fd_core_bpf_migration_config_t const * core_bpf_migration_config;
      41             : };
      42             : typedef struct fd_stateless_builtin_program fd_stateless_builtin_program_t;
      43             : 
      44             : struct fd_precompile_program {
      45             :   fd_pubkey_t const * pubkey;
      46             :   ulong               feature_offset;
      47             :   int                 (*verify_fn)(fd_exec_instr_ctx_t*);
      48             : };
      49             : typedef struct fd_precompile_program fd_precompile_program_t;
      50             : 
      51             : FD_PROTOTYPES_BEGIN
      52             : 
      53             : /* Initialize the builtin program accounts */
      54             : void
      55             : fd_builtin_programs_init( fd_bank_t *               bank,
      56             :                           fd_funk_t *               funk,
      57             :                           fd_funk_txn_xid_t const * xid,
      58             :                           fd_capture_ctx_t *        capture_ctx );
      59             : 
      60             : void
      61             : fd_write_builtin_account( fd_bank_t  *              bank,
      62             :                           fd_funk_t  *              funk,
      63             :                           fd_funk_txn_xid_t const * xid,
      64             :                           fd_capture_ctx_t *        capture_ctx,
      65             :                           fd_pubkey_t const         pubkey,
      66             :                           char const *              data,
      67             :                           ulong                     sz );
      68             : 
      69             : fd_builtin_program_t const *
      70             : fd_builtins( void );
      71             : 
      72             : ulong
      73             : fd_num_builtins( void );
      74             : 
      75             : fd_stateless_builtin_program_t const *
      76             : fd_stateless_builtins( void );
      77             : 
      78             : ulong
      79             : fd_num_stateless_builtins( void );
      80             : 
      81             : /*  `migrated_yet` is an output value thats set based on the rules below:
      82             : 
      83             :     | Return Value | *migrated_yet     | Description                                                              |
      84             :     |--------------|-------------------|--------------------------------------------------------------------------|
      85             :     |      0       |        0          | Program is not a migrating builtin program                               |
      86             :     |      1       |        0          | Program is a migrating builtin program id, BUT has not been migrated yet |
      87             :     |      1       |        1          | Program is a migrating builtin program id, AND has been migrated to BPF  |
      88             : */
      89             : uchar
      90             : fd_is_migrating_builtin_program( fd_exec_txn_ctx_t const * txn_ctx,
      91             :                                  fd_pubkey_t const *       pubkey,
      92             :                                  uchar *                   migrated_yet );
      93             : 
      94             : uchar
      95             : fd_is_non_migrating_builtin_program( fd_pubkey_t const * pubkey );
      96             : 
      97             : fd_precompile_program_t const *
      98             : fd_precompiles( void );
      99             : 
     100             : ulong
     101             : fd_num_precompiles( void );
     102             : 
     103             : FD_PROTOTYPES_END
     104             : 
     105             : #endif /* HEADER_fd_src_flamenco_runtime_program_fd_buildin_programs_h */

Generated by: LCOV version 1.14