Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_runtime_context_fd_capture_ctx_h 2 : #define HEADER_fd_src_flamenco_runtime_context_fd_capture_ctx_h 3 : 4 : #include "../../capture/fd_solcap_writer.h" 5 : #include "../fd_runtime_const.h" 6 : 7 : /* fd_capture_ctx_account_update_msg_t is the message sent from 8 : writer tile to replay tile that notifies the solcap writer that an 9 : account update has occurred. */ 10 : 11 : struct __attribute__((packed)) fd_capture_ctx_account_update_msg { 12 : fd_pubkey_t pubkey; 13 : fd_solana_account_meta_t info; 14 : ulong data_sz; 15 : fd_hash_t hash; 16 : /* Account data follows immediately after this struct */ 17 : }; 18 : typedef struct fd_capture_ctx_account_update_msg fd_capture_ctx_account_update_msg_t; 19 0 : #define FD_CAPTURE_CTX_ACCOUNT_UPDATE_MSG_FOOTPRINT (FD_RUNTIME_ACC_SZ_MAX + sizeof(fd_capture_ctx_account_update_msg_t)) 20 : 21 : /* Maximum number of accounts that can be updated in a single transaction */ 22 0 : #define FD_CAPTURE_CTX_MAX_ACCOUNT_UPDATES (128UL) 23 0 : #define FD_CAPTURE_CTX_ACCOUNT_UPDATE_BUFFER_SZ (FD_CAPTURE_CTX_MAX_ACCOUNT_UPDATES * sizeof(fd_capture_ctx_account_update_msg_t)) 24 : 25 : /* Context needed to do solcap capture during execution of transactions */ 26 : #define FD_CAPTURE_CTX_ALIGN (8UL) 27 : struct __attribute__((aligned(FD_CAPTURE_CTX_ALIGN))) fd_capture_ctx { 28 : ulong magic; /* ==FD_CAPTURE_CTX_MAGIC */ 29 : 30 : /* Solcap */ 31 : ulong solcap_start_slot; 32 : int trace_dirfd; 33 : int trace_mode; 34 : fd_solcap_writer_t * capture; 35 : int capture_txns; /* Capturing txns can add significant time */ 36 : 37 : /* Checkpointing */ 38 : ulong checkpt_freq; /* Must be a rooted slot */ 39 : char const * checkpt_path; /* Wksp checkpoint format */ 40 : char const * checkpt_archive; /* Funk archive format */ 41 : 42 : /*======== PROTOBUF ========*/ 43 : char const * dump_proto_output_dir; 44 : char const * dump_proto_sig_filter; 45 : ulong dump_proto_start_slot; 46 : 47 : /* Instruction Capture */ 48 : int dump_instr_to_pb; 49 : 50 : /* Transaction Capture */ 51 : int dump_txn_to_pb; 52 : 53 : /* Block Capture */ 54 : int dump_block_to_pb; 55 : 56 : /* Syscall Capture */ 57 : int dump_syscall_to_pb; 58 : 59 : /* ELF Capture */ 60 : int dump_elf_to_pb; 61 : 62 : /* Account update buffer, account updates to be sent over the writer_replay link are buffered here 63 : to avoid passing stem down into the runtime. 64 : 65 : FIXME: write directly into the dcache to avoid the memory copy and allocation 66 : TODO: remove this when solcap v2 is here. */ 67 : uchar * account_updates_buffer; 68 : uchar * account_updates_buffer_ptr; 69 : ulong account_updates_len; 70 : }; 71 : typedef struct fd_capture_ctx fd_capture_ctx_t; 72 0 : #define FD_CAPTURE_CTX_FOOTPRINT ( sizeof(fd_capture_ctx_t) + fd_solcap_writer_footprint() + FD_CAPTURE_CTX_ACCOUNT_UPDATE_BUFFER_SZ ) 73 0 : #define FD_CAPTURE_CTX_MAGIC (0x193ECD2A6C395195UL) /* random */ 74 : 75 : FD_PROTOTYPES_BEGIN 76 : 77 : void * 78 : fd_capture_ctx_new( void * mem ); 79 : 80 : fd_capture_ctx_t * 81 : fd_capture_ctx_join( void * mem ); 82 : 83 : void * 84 : fd_capture_ctx_leave( fd_capture_ctx_t * ctx ); 85 : 86 : void * 87 : fd_capture_ctx_delete( void * mem ); 88 : 89 : /* Temporary locks to protect the blockstore txn_map. See comment in 90 : fd_runtime_write_transaction_status. */ 91 : void 92 : fd_capture_ctx_txn_status_start_read( void ); 93 : 94 : void 95 : fd_capture_ctx_txn_status_end_read( void ); 96 : 97 : void 98 : fd_capture_ctx_txn_status_start_write( void ); 99 : 100 : void 101 : fd_capture_ctx_txn_status_end_write( void ); 102 : 103 : FD_PROTOTYPES_END 104 : 105 : #endif /* HEADER_fd_src_flamenco_runtime_context_fd_capture_ctx_h */