Line data Source code
1 : #ifndef HEADER_fd_src_discof_replay_fd_exec_h 2 : #define HEADER_fd_src_discof_replay_fd_exec_h 3 : 4 : #include "../../disco/fd_txn_p.h" 5 : #include "../../flamenco/fd_flamenco_base.h" 6 : #include "../../choreo/tower/fd_tower_serdes.h" 7 : #include "../../flamenco/alpenglow/fd_block_marker.h" 8 : 9 : /* Exec tile task types. */ 10 0 : #define FD_EXECRP_TT_TXN_EXEC (1UL) /* Transaction execution. */ 11 0 : #define FD_EXECRP_TT_TXN_SIGVERIFY (2UL) /* Transaction sigverify. */ 12 0 : #define FD_EXECRP_TT_POH_HASH (3UL) /* PoH hashing. */ 13 0 : #define FD_EXECRP_TT_CERT_VERIFY (6UL) /* Alpenglow footer cert verify. */ 14 : 15 : /* Sent from the replay tile to the exec tiles. These describe one of 16 : several types of tasks for an exec tile. An idx to the bank in the 17 : bank pool must be sent over because the key of the bank will change 18 : as FEC sets are processed. */ 19 : 20 : struct fd_execrp_txn_exec_msg { 21 : ulong bank_idx; 22 : ulong txn_idx; 23 : fd_txn_p_t txn[ 1 ]; 24 : 25 : /* Used currently by solcap to maintain ordering of messages 26 : this will change to using txn sigs eventually */ 27 : ulong capture_txn_idx; 28 : 29 : /* FEC-set merkle root at dispatch time. */ 30 : uchar fec_merkle_root[ 32 ]; 31 : 32 : /* 0-indexed position of this transaction within its block. */ 33 : ulong index_in_slot; 34 : }; 35 : typedef struct fd_execrp_txn_exec_msg fd_execrp_txn_exec_msg_t; 36 : 37 : struct fd_execrp_txn_sigverify_msg { 38 : ulong bank_idx; 39 : ulong txn_idx; 40 : fd_txn_p_t txn[ 1 ]; 41 : }; 42 : typedef struct fd_execrp_txn_sigverify_msg fd_execrp_txn_sigverify_msg_t; 43 : 44 0 : #define FD_EXECRP_POH_PARA 16 45 : struct fd_execrp_poh_hash_msg { 46 : ulong bank_idx; 47 : ulong cnt; /* In [1,FD_EXECRP_POH_PARA] */ 48 : ulong hashcnt; /* Same for every element of the batch */ 49 : fd_hash_t hash[ FD_EXECRP_POH_PARA ]; 50 : }; 51 : typedef struct fd_execrp_poh_hash_msg fd_execrp_poh_hash_msg_t; 52 : 53 : struct fd_execrp_cert_verify_msg { 54 : ulong bank_idx; 55 : ulong quorum; /* quorum numerator, 0 for a reward cert */ 56 : uint tag; /* vote tag */ 57 : ushort shred_version; 58 : int has_hm; /* hm is the payload's H(m), from replay's memo */ 59 : blst_p2_affine hm; 60 : fd_block_footer_cert_t cert[ 1 ]; 61 : }; 62 : typedef struct fd_execrp_cert_verify_msg fd_execrp_cert_verify_msg_t; 63 : 64 : union fd_execrp_task_msg { 65 : fd_execrp_txn_exec_msg_t txn_exec; 66 : fd_execrp_txn_sigverify_msg_t txn_sigverify; 67 : fd_execrp_poh_hash_msg_t poh_hash; 68 : fd_execrp_cert_verify_msg_t cert_verify; 69 : }; 70 : 71 : typedef union fd_execrp_task_msg fd_execrp_task_msg_t; 72 : 73 : /* Sent from exec tiles to the replay tile, notifying the replay tile 74 : that a task has been completed. That is, if the task has any 75 : observable side effects, such as updates to accounts, then those side 76 : effects are fully visible on any other exec tile. */ 77 : 78 : struct fd_execrp_txn_exec_done_msg { 79 : ulong txn_idx; 80 : 81 : /* These flags form a nested series of if statements. 82 : if( is_committable ) { 83 : if( is_fees_only ) { 84 : instructions will not be executed 85 : txn_err will be non-zero and will be one of the account loader errors 86 : } else if( is_noop ) { 87 : instructions will not be executed and no fees charged 88 : txn_err will be non-zero and will be a fee payer validation error 89 : } else { 90 : instructions will execute 91 : if( txn_err is non-zero ) { 92 : there's likely an instruction error 93 : } else { 94 : transaction executed successfully 95 : https://github.com/anza-xyz/agave/blob/v3.1.8/svm/src/transaction_execution_result.rs#L26 96 : } 97 : } 98 : } else { 99 : either failed before account loading, or failed cost tracker 100 : } 101 : */ 102 : int is_committable; 103 : int is_fees_only; 104 : int is_noop; 105 : int txn_err; 106 : int is_simple_vote; 107 : 108 : /* LONG_MAX if stage was not reached */ 109 : long tick_load_start; 110 : long tick_check_start; 111 : long tick_exec_start; 112 : long tick_commit_start; 113 : long tick_commit_end; 114 : 115 : uint compute_units_consumed; /* possibly zero if is_committable is zero */ 116 : ulong transaction_fee; 117 : ulong priority_fee; 118 : ulong tips; 119 : 120 : /* used by monitoring tools */ 121 : ulong slot; 122 : ulong bank_seq; 123 : ushort start_shred_idx; 124 : ushort end_shred_idx; 125 : 126 : /* vote.slot==ULONG_MAX if this was not a vote transaction */ 127 : struct { 128 : ulong slot; 129 : ulong vote_slots[ 31UL ]; 130 : uchar vote_slot_cnt; 131 : fd_pubkey_t identity[ 1 ]; 132 : fd_pubkey_t vote_acct[ 1 ]; 133 : } vote; 134 : }; 135 : typedef struct fd_execrp_txn_exec_done_msg fd_execrp_txn_exec_done_msg_t; 136 : 137 : struct fd_execrp_txn_sigverify_done_msg { 138 : ulong txn_idx; 139 : int err; 140 : }; 141 : typedef struct fd_execrp_txn_sigverify_done_msg fd_execrp_txn_sigverify_done_msg_t; 142 : 143 : struct fd_execrp_poh_hash_done_msg { 144 : ulong cnt; 145 : fd_hash_t hash[ FD_EXECRP_POH_PARA ]; 146 : }; 147 : typedef struct fd_execrp_poh_hash_done_msg fd_execrp_poh_hash_done_msg_t; 148 : 149 : struct fd_execrp_cert_verify_done_msg { 150 : int err; 151 : int has_hm; /* hm is the H(m) the tile hashed, for replay's memo */ 152 : blst_p2_affine hm; 153 : }; 154 : typedef struct fd_execrp_cert_verify_done_msg fd_execrp_cert_verify_done_msg_t; 155 : 156 : struct fd_execrp_task_done_msg { 157 : ulong bank_idx; 158 : union { 159 : fd_execrp_txn_exec_done_msg_t txn_exec[ 1 ]; 160 : fd_execrp_txn_sigverify_done_msg_t txn_sigverify[ 1 ]; 161 : fd_execrp_poh_hash_done_msg_t poh_hash[ 1 ]; 162 : fd_execrp_cert_verify_done_msg_t cert_verify[ 1 ]; 163 : }; 164 : }; 165 : typedef struct fd_execrp_task_done_msg fd_execrp_task_done_msg_t; 166 : 167 : #endif /* HEADER_fd_src_discof_replay_fd_execrp_h */