Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_fd_runtime_init_h 2 : #define HEADER_fd_src_flamenco_runtime_fd_runtime_init_h 3 : 4 : /* fd_runtime_init.h provides APIs for backing up and restoring a Solana 5 : runtime environment. This file must not depend on fd_executor.h. */ 6 : 7 : #include "../fd_flamenco_base.h" 8 : #include "../../funk/fd_funk_rec.h" 9 : 10 : #define FD_RUNTIME_ENC_BINCODE 0xB13C0DEFU /* classic bincode encoding */ 11 : #define FD_RUNTIME_ENC_ARCHIVE 0xA3C417EAU /* archival encoding */ 12 : 13 : /* https://github.com/anza-xyz/solana-sdk/blob/6512aca61167088ce10f2b545c35c9bcb1400e70/feature-gate-interface/src/lib.rs#L36-L38 */ 14 : #define FD_FEATURE_SIZEOF (9UL) 15 : 16 : FD_PROTOTYPES_BEGIN 17 : 18 : static inline fd_funk_rec_key_t 19 0 : fd_runtime_epoch_bank_key( void ) { 20 0 : fd_funk_rec_key_t id; 21 0 : fd_memset(&id, 1, sizeof(id)); 22 0 : id.uc[FD_FUNK_REC_KEY_FOOTPRINT - 1] = FD_FUNK_KEY_EPOCH_BANK; 23 0 : return id; 24 0 : } 25 : 26 : static inline fd_funk_rec_key_t 27 0 : fd_runtime_slot_bank_key( void ) { 28 0 : fd_funk_rec_key_t id; 29 0 : fd_memset(&id, 1, sizeof(id)); 30 0 : id.uc[FD_FUNK_REC_KEY_FOOTPRINT - 1] = FD_FUNK_KEY_SLOT_BANK; 31 0 : return id; 32 0 : } 33 : 34 : int 35 : fd_runtime_save_slot_bank( fd_exec_slot_ctx_t * slot_ctx ); 36 : 37 : int 38 : fd_runtime_save_epoch_bank( fd_exec_slot_ctx_t * slot_ctx ); 39 : 40 : /* fd_features_restore loads all known feature accounts from the 41 : accounts database. This is used when initializing bank from a 42 : snapshot. */ 43 : 44 : void 45 : fd_features_restore( fd_exec_slot_ctx_t * slot_ctx, fd_spad_t * runtime_spad ); 46 : 47 : /* Recover slot_bank and epoch_bank from funk. */ 48 : 49 : void 50 : fd_runtime_recover_banks( fd_exec_slot_ctx_t * slot_ctx, 51 : int delete_first, 52 : int clear_first, 53 : fd_spad_t * runtime_spad ); 54 : 55 : void 56 : fd_runtime_delete_banks( fd_exec_slot_ctx_t * slot_ctx ); 57 : 58 : FD_PROTOTYPES_END 59 : 60 : #endif /* HEADER_fd_src_flamenco_runtime_fd_runtime_init_h */