LCOV - code coverage report
Current view: top level - flamenco/runtime/program - fd_system_program.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 10 0.0 %
Date: 2025-09-18 04:41:32 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_flamenco_runtime_program_fd_system_program_h
       2             : #define HEADER_fd_src_flamenco_runtime_program_fd_system_program_h
       3             : 
       4             : #include "../../fd_flamenco_base.h"
       5             : #include "../../types/fd_types.h"
       6             : 
       7             : /* Custom error types */
       8             : 
       9           0 : #define FD_SYSTEM_PROGRAM_ERR_ACCT_ALREADY_IN_USE              (0)  /* SystemError::AccountAlreadyInUse */
      10           0 : #define FD_SYSTEM_PROGRAM_ERR_RESULT_WITH_NEGATIVE_LAMPORTS    (1)  /* SystemError::ResultWithNegativeLamports */
      11             : #define FD_SYSTEM_PROGRAM_ERR_INVALID_PROGRAM_ID               (2)  /* SystemError::InvalidProgramId */
      12           0 : #define FD_SYSTEM_PROGRAM_ERR_INVALID_ACCT_DATA_LEN            (3)  /* SystemError::InvalidAccountDataLength */
      13             : #define FD_SYSTEM_PROGRAM_ERR_MAX_SEED_LEN_EXCEEDED            (4)  /* SystemError::MaxSeedLengthExceeded */
      14           0 : #define FD_SYSTEM_PROGRAM_ERR_ADDR_WITH_SEED_MISMATCH          (5)  /* SystemError::AddressWithSeedMismatch */
      15           0 : #define FD_SYSTEM_PROGRAM_ERR_NONCE_NO_RECENT_BLOCKHASHES      (6)  /* SystemError::NonceNoRecentBlockhashes */
      16           0 : #define FD_SYSTEM_PROGRAM_ERR_NONCE_BLOCKHASH_NOT_EXPIRED      (7)  /* SystemError::NonceBlockhashNotExpired */
      17             : #define FD_SYSTEM_PROGRAM_ERR_NONCE_UNEXPECTED_BLOCKHASH_VALUE (8)  /* SystemError::NonceUnexpectedBlockhashValue */
      18             : 
      19           0 : #define FD_SYSTEM_PROGRAM_NONCE_DLEN (80UL)
      20             : 
      21             : /* https://github.com/anza-xyz/solana-sdk/blob/nonce-account%40v2.2.1/nonce-account/src/lib.rs#L49-L53 */
      22           0 : #define FD_SYSTEM_PROGRAM_NONCE_ACCOUNT_KIND_UNKNOWN (-1)
      23           0 : #define FD_SYSTEM_PROGRAM_NONCE_ACCOUNT_KIND_SYSTEM  (0)
      24           0 : #define FD_SYSTEM_PROGRAM_NONCE_ACCOUNT_KIND_NONCE   (1)
      25             : 
      26             : FD_PROTOTYPES_BEGIN
      27             : 
      28             : /* fd_system_program_execute is the entrypoint for the system program */
      29             : 
      30             : int fd_system_program_execute( fd_exec_instr_ctx_t * ctx ) ;
      31             : 
      32             : /* System program instruction handlers */
      33             : 
      34             : int fd_system_program_exec_create_account          ( fd_exec_instr_ctx_t * ctx, fd_system_program_instruction_create_account_t const *           data     );
      35             : int fd_system_program_exec_assign                  ( fd_exec_instr_ctx_t * ctx, fd_pubkey_t const *                                              owner    );
      36             : int fd_system_program_exec_transfer                ( fd_exec_instr_ctx_t * ctx, ulong                                                            lamports );
      37             : int fd_system_program_exec_create_account_with_seed( fd_exec_instr_ctx_t * ctx, fd_system_program_instruction_create_account_with_seed_t const * data     );
      38             : int fd_system_program_exec_advance_nonce_account   ( fd_exec_instr_ctx_t * ctx                                                                            );
      39             : int fd_system_program_exec_withdraw_nonce_account  ( fd_exec_instr_ctx_t * ctx, ulong                                                            lamports );
      40             : int fd_system_program_exec_initialize_nonce_account( fd_exec_instr_ctx_t * ctx, fd_pubkey_t const *                                              pubkey   );
      41             : int fd_system_program_exec_authorize_nonce_account ( fd_exec_instr_ctx_t * ctx, fd_pubkey_t const *                                              pubkey   );
      42             : int fd_system_program_exec_allocate                ( fd_exec_instr_ctx_t * ctx, ulong                                                            space    );
      43             : int fd_system_program_exec_allocate_with_seed      ( fd_exec_instr_ctx_t * ctx, fd_system_program_instruction_allocate_with_seed_t const *       data     );
      44             : int fd_system_program_exec_assign_with_seed        ( fd_exec_instr_ctx_t * ctx, fd_system_program_instruction_assign_with_seed_t const *         data     );
      45             : int fd_system_program_exec_transfer_with_seed      ( fd_exec_instr_ctx_t * ctx, fd_system_program_instruction_transfer_with_seed_t const *       data     );
      46             : int fd_system_program_exec_upgrade_nonce_account   ( fd_exec_instr_ctx_t * ctx                                                                            );
      47             : 
      48             : /* User APIs */
      49             : 
      50             : /* fd_check_transaction_age returns 0 if the transactions age is valid,
      51             :    returns non-zero otherwise. This is determined by the age of the
      52             :    blockhash provided in the transaction message or by the validity of
      53             :    the nonce provided in the transaction. */
      54             : 
      55             : int
      56             : fd_check_transaction_age( fd_exec_txn_ctx_t * txn_ctx );
      57             : 
      58             : /* `fd_get_system_account_kind()` determines whether an account is
      59             :    a normal system program account or a nonce account. Returns:
      60             :    - FD_SYSTEM_PROGRAM_NONCE_ACCOUNT_KIND_SYSTEM if the account is a
      61             :      normal system program account
      62             :    - FD_SYSTEM_PROGRAM_NONCE_ACCOUNT_KIND_NONCE if the account is a
      63             :      nonce account
      64             :    - FD_SYSTEM_PROGRAM_NONCE_ACCOUNT_KIND_UNKNOWN otherwise
      65             :    https://github.com/anza-xyz/solana-sdk/blob/nonce-account%40v2.2.1/nonce-account/src/lib.rs#L55-L71 */
      66             : 
      67             : int
      68             : fd_get_system_account_kind( fd_txn_account_t * account,
      69             :                             fd_spad_t *        exec_spad );
      70             : 
      71             : FD_PROTOTYPES_END
      72             : 
      73             : #endif /* HEADER_fd_src_flamenco_runtime_program_fd_system_program_h */

Generated by: LCOV version 1.14