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

Generated by: LCOV version 1.14