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

Generated by: LCOV version 1.14