Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_fd_flamenco_base_h 2 : #define HEADER_fd_src_flamenco_fd_flamenco_base_h 3 : 4 : #include "../ballet/base58/fd_base58.h" 5 : #include "types/fd_cast.h" 6 : 7 : #define FD_DEFAULT_SLOTS_PER_EPOCH ( 432000UL ) 8 : #define FD_DEFAULT_SHREDS_PER_EPOCH ( ( 1 << 15UL ) * FD_DEFAULT_SLOTS_PER_EPOCH ) 9 48 : #define FD_SLOT_NULL ( ULONG_MAX ) 10 0 : #define FD_SHRED_IDX_NULL ( UINT_MAX ) 11 : 12 : /* Forward declarations */ 13 : 14 : struct fd_bank; 15 : typedef struct fd_bank fd_bank_t; 16 : 17 : struct fd_banks; 18 : typedef struct fd_banks fd_banks_t; 19 : 20 : struct fd_exec_instr_ctx; 21 : typedef struct fd_exec_instr_ctx fd_exec_instr_ctx_t; 22 : 23 : struct fd_acc_mgr; 24 : typedef struct fd_acc_mgr fd_acc_mgr_t; 25 : 26 : struct fd_capture_ctx; 27 : typedef struct fd_capture_ctx fd_capture_ctx_t; 28 : 29 : struct fd_borrowed_account; 30 : typedef struct fd_borrowed_account fd_borrowed_account_t; 31 : 32 : struct fd_txn_account; 33 : typedef struct fd_txn_account fd_txn_account_t; 34 : 35 : struct fd_exec_accounts; 36 : typedef struct fd_exec_accounts fd_exec_accounts_t; 37 : 38 : union fd_features; 39 : typedef union fd_features fd_features_t; 40 : 41 : struct fd_progcache; 42 : typedef struct fd_progcache fd_progcache_t; 43 : 44 : union fd_runtime_stack; 45 : typedef union fd_runtime_stack fd_runtime_stack_t; 46 : 47 : struct fd_runtime; 48 : typedef struct fd_runtime fd_runtime_t; 49 : 50 : struct fd_txn_in; 51 : typedef struct fd_txn_in fd_txn_in_t; 52 : 53 : struct fd_txn_out; 54 : typedef struct fd_txn_out fd_txn_out_t; 55 : 56 : struct fd_log_collector; 57 : typedef struct fd_log_collector fd_log_collector_t; 58 : 59 : struct fd_genesis; 60 : typedef struct fd_genesis fd_genesis_t; 61 : 62 : struct fd_account_meta { 63 : uchar owner[32]; 64 : ulong lamports; 65 : ulong slot; 66 : uint dlen; 67 : uchar executable; 68 : uchar padding[3]; 69 : }; 70 : typedef struct fd_account_meta fd_account_meta_t; 71 : 72 : FD_FN_PURE static inline uchar * 73 645 : fd_account_data( fd_account_meta_t const * acc ) { 74 645 : return (uchar *)( acc+1 ); 75 645 : } 76 : 77 : FD_PROTOTYPES_BEGIN 78 : 79 : /* fd_acct_addr_cstr converts the given Solana address into a base58- 80 : encoded cstr. Returns cstr. On return cstr contains a string with 81 : length in [32,44] (excluding NULL terminator). */ 82 : 83 : static inline char * 84 : fd_acct_addr_cstr( char cstr[ FD_BASE58_ENCODED_32_SZ ], 85 0 : uchar const addr[ 32 ] ) { 86 : return fd_base58_encode_32( addr, NULL, cstr ); 87 0 : } 88 : 89 : FD_PROTOTYPES_END 90 : 91 : #endif /* HEADER_fd_src_flamenco_fd_flamenco_base_h */