LCOV - code coverage report
Current view: top level - discof/replay - fd_execrp.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 11 0.0 %
Date: 2026-11-11 12:40:43 Functions: 0 12 0.0 %

          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 "../../tango/fd_tango_base.h"
       6             : #include "../../flamenco/fd_flamenco_base.h"
       7             : #include "../../flamenco/alpenglow/fd_block_marker.h"
       8             : #include "../../flamenco/alpenglow/fd_alpenglow.h"
       9             : #include "../../ballet/lthash/fd_lthash.h"
      10             : 
      11             : /* Exec tile task types. */
      12           0 : #define FD_EXECRP_TT_TXN_EXEC      (1UL) /* Transaction execution. */
      13           0 : #define FD_EXECRP_TT_TXN_SIGVERIFY (2UL) /* Transaction sigverify. */
      14           0 : #define FD_EXECRP_TT_POH_HASH      (3UL) /* PoH hashing. */
      15           0 : #define FD_EXECRP_TT_LTHASH_SUB    (4UL) /* Hash accounts as they are in the parent bank's fork. */
      16           0 : #define FD_EXECRP_TT_LTHASH_ADD    (5UL) /* Hash accounts as they are in this bank's fork. */
      17           0 : #define FD_EXECRP_TT_CERT_VERIFY   (6UL) /* Alpenglow footer cert verify. */
      18           0 : #define FD_EXECRP_TT_REWARDS       (7UL) /* Alpenglow footer vote rewards, one slice of the signers. */
      19             : 
      20             : /* Sent from the replay tile to the exec tiles.  These describe one of
      21             :    several types of tasks for an exec tile.  An idx to the bank in the
      22             :    bank pool must be sent over because the key of the bank will change
      23             :    as FEC sets are processed. */
      24             : 
      25             : struct fd_execrp_txn_exec_msg {
      26             :   ulong      bank_idx;
      27             :   ulong      txn_idx;
      28             :   fd_txn_p_t txn[ 1 ];
      29             : 
      30             :   /* Used currently by solcap to maintain ordering of messages
      31             :      this will change to using txn sigs eventually */
      32             :   ulong      capture_txn_idx;
      33             : 
      34             :   /* FEC-set merkle root at dispatch time. */
      35             :   uchar      fec_merkle_root[ 32 ];
      36             : 
      37             :   /* 0-indexed position of this transaction within its block. */
      38             :   ulong      index_in_slot;
      39             : 
      40             :   /* Non-zero asks the exec tile to leave the transaction's expanded
      41             :      writable address lookup table accounts in its result entry. */
      42             :   int        want_alts;
      43             : };
      44             : typedef struct fd_execrp_txn_exec_msg fd_execrp_txn_exec_msg_t;
      45             : 
      46             : struct fd_execrp_txn_sigverify_msg {
      47             :   ulong      bank_idx;
      48             :   ulong      txn_idx;
      49             :   fd_txn_p_t txn[ 1 ];
      50             : };
      51             : typedef struct fd_execrp_txn_sigverify_msg fd_execrp_txn_sigverify_msg_t;
      52             : 
      53           0 : #define FD_EXECRP_POH_PARA 16
      54             : struct fd_execrp_poh_hash_msg {
      55             :   ulong     bank_idx;
      56             :   ulong     cnt;     /* In [1,FD_EXECRP_POH_PARA] */
      57             :   ulong     hashcnt; /* 0 or 1, same for every element of the batch */
      58             :   fd_hash_t hash[ FD_EXECRP_POH_PARA ];
      59             : };
      60             : typedef struct fd_execrp_poh_hash_msg fd_execrp_poh_hash_msg_t;
      61             : 
      62             : struct fd_execrp_cert_verify_msg {
      63             :   ulong                  bank_idx;
      64             :   ulong                  quorum;        /* quorum numerator, 0 for a reward cert */
      65             :   uint                   tag;           /* vote tag */
      66             :   ushort                 shred_version;
      67             :   int                    has_hm;        /* hm is the payload's H(m), from replay's memo */
      68             :   fd_bls_hash_t         hm;
      69             :   fd_block_footer_cert_t cert[ 1 ];
      70             : };
      71             : typedef struct fd_execrp_cert_verify_msg fd_execrp_cert_verify_msg_t;
      72             : 
      73             : /* This is the largest power of two at which the LtHash task still fits
      74             :    the task union below. */
      75             : 
      76             : #define FD_EXECRP_LTHASH_BATCH_MAX (128UL)
      77             : 
      78             : struct fd_execrp_lthash_msg {
      79             :   ulong          bank_idx;
      80             :   ulong          cnt; /* In [1, FD_EXECRP_LTHASH_BATCH_MAX] */
      81             :   fd_acct_addr_t acct[ FD_EXECRP_LTHASH_BATCH_MAX ];
      82             : };
      83             : typedef struct fd_execrp_lthash_msg fd_execrp_lthash_msg_t;
      84             : 
      85             : struct fd_execrp_rewards_msg {
      86             :   ulong                       bank_idx;
      87             :   ulong                       slice_idx; /* in [0, slice_cnt) */
      88             :   ulong                       slice_cnt;
      89             :   fd_alpenglow_rewards_plan_t plan;
      90             : };
      91             : typedef struct fd_execrp_rewards_msg fd_execrp_rewards_msg_t;
      92             : 
      93             : union fd_execrp_task_msg {
      94             :   fd_execrp_txn_exec_msg_t      txn_exec;
      95             :   fd_execrp_txn_sigverify_msg_t txn_sigverify;
      96             :   fd_execrp_poh_hash_msg_t      poh_hash;
      97             :   fd_execrp_cert_verify_msg_t   cert_verify;
      98             :   fd_execrp_lthash_msg_t        lthash;
      99             :   fd_execrp_rewards_msg_t       rewards;
     100             : };
     101             : 
     102             : typedef union fd_execrp_task_msg fd_execrp_task_msg_t;
     103             : 
     104             : FD_STATIC_ASSERT( sizeof(fd_execrp_lthash_msg_t) <=sizeof(fd_execrp_txn_exec_msg_t), execrp_lthash_msg_sz  );
     105             : FD_STATIC_ASSERT( sizeof(fd_execrp_rewards_msg_t)<=sizeof(fd_execrp_txn_exec_msg_t), execrp_rewards_msg_sz );
     106             : 
     107             : /* Sent from exec tiles to the replay tile, notifying the replay tile
     108             :    that a task has been completed.  That is, if the task has any
     109             :    observable side effects, such as updates to accounts, then those side
     110             :    effects are fully visible on any other exec tile. */
     111             : 
     112             : struct fd_execrp_txn_exec_done_msg {
     113             :   ulong txn_idx;
     114             : 
     115             :   /* These flags form a nested series of if statements.
     116             :      if( is_committable ) {
     117             :        if( is_fees_only ) {
     118             :          instructions will not be executed
     119             :          txn_err will be non-zero and will be one of the account loader errors
     120             :        } else if( is_noop ) {
     121             :          instructions will not be executed and no fees charged
     122             :          txn_err will be non-zero and will be a fee payer validation error
     123             :        } else {
     124             :          instructions will execute
     125             :          if( txn_err is non-zero ) {
     126             :            there's likely an instruction error
     127             :          } else {
     128             :            transaction executed successfully
     129             :            https://github.com/anza-xyz/agave/blob/v3.1.8/svm/src/transaction_execution_result.rs#L26
     130             :          }
     131             :        }
     132             :      } else {
     133             :        either failed before account loading, or failed cost tracker
     134             :      }
     135             :   */
     136             :   int is_committable;
     137             :   int is_fees_only;
     138             :   int is_noop;
     139             :   int txn_err;
     140             : 
     141             :   /* Number of the transaction's expanded writable address lookup table
     142             :      accounts the exec tile left in its result entry, in transaction
     143             :      order.  0 unless the request had want_alts set and the expansion
     144             :      succeeded. */
     145             :   uchar alt_writable_cnt;
     146             : 
     147             :   /* LONG_MAX if stage was not reached */
     148             :   long tick_load_start;
     149             :   long tick_check_start;
     150             :   long tick_exec_start;
     151             :   long tick_commit_start;
     152             :   long tick_commit_end;
     153             : 
     154             :   uint  compute_units_consumed; /* possibly zero if is_committable is zero */
     155             :   ulong transaction_fee;
     156             :   ulong priority_fee;
     157             :   ulong tips;
     158             : 
     159             :   /* used by monitoring tools */
     160             :   ulong  slot;
     161             :   ulong  bank_seq;
     162             :   ushort start_shred_idx;
     163             :   ushort end_shred_idx;
     164             : };
     165             : typedef struct fd_execrp_txn_exec_done_msg fd_execrp_txn_exec_done_msg_t;
     166             : 
     167             : struct fd_execrp_txn_sigverify_done_msg {
     168             :   ulong txn_idx;
     169             :   int   err;
     170             : };
     171             : typedef struct fd_execrp_txn_sigverify_done_msg fd_execrp_txn_sigverify_done_msg_t;
     172             : 
     173             : struct fd_execrp_poh_hash_done_msg {
     174             :   ulong     cnt;
     175             :   fd_hash_t hash[ FD_EXECRP_POH_PARA ];
     176             : };
     177             : typedef struct fd_execrp_poh_hash_done_msg fd_execrp_poh_hash_done_msg_t;
     178             : 
     179             : struct fd_execrp_cert_verify_done_msg {
     180             :   int            err;
     181             :   int            has_hm; /* hm is the H(m) the tile hashed, for replay's memo */
     182             :   fd_bls_hash_t hm;
     183             : };
     184             : typedef struct fd_execrp_cert_verify_done_msg fd_execrp_cert_verify_done_msg_t;
     185             : 
     186             : struct fd_execrp_lthash_done_msg {
     187             :   ulong cnt;
     188             : };
     189             : typedef struct fd_execrp_lthash_done_msg fd_execrp_lthash_done_msg_t;
     190             : 
     191             : struct fd_execrp_rewards_done_msg {
     192             :   int   err;
     193             :   ulong leader_credits; /* The slice's share of the leader's credits.  Its lthash delta is in the tile's result entry. */
     194             : };
     195             : typedef struct fd_execrp_rewards_done_msg fd_execrp_rewards_done_msg_t;
     196             : 
     197             : struct fd_execrp_task_done_msg {
     198             :   ulong bank_idx;
     199             :   union {
     200             :     fd_execrp_txn_exec_done_msg_t      txn_exec[ 1 ];
     201             :     fd_execrp_txn_sigverify_done_msg_t txn_sigverify[ 1 ];
     202             :     fd_execrp_poh_hash_done_msg_t      poh_hash[ 1 ];
     203             :     fd_execrp_cert_verify_done_msg_t   cert_verify[ 1 ];
     204             :     fd_execrp_lthash_done_msg_t        lthash[ 1 ];
     205             :     fd_execrp_rewards_done_msg_t       rewards[ 1 ];
     206             :   };
     207             : };
     208             : typedef struct fd_execrp_task_done_msg fd_execrp_task_done_msg_t;
     209             : 
     210             : /* Task results too large for the done message.  There is one entry per
     211             :    exec tile.  The exec tile fills its entry before it publishes the
     212             :    done message, and the task type in the sig says which member is
     213             :    valid. */
     214             : 
     215             : struct fd_execrp_result {
     216             :   union {
     217             :     fd_lthash_value_t lthash;                                   /* LTHASH_SUB, LTHASH_ADD, REWARDS. */
     218             :     fd_pubkey_t       alt_writable[ FD_TXN_ACCT_ADDR_MAX-1UL ]; /* TXN_EXEC.  alt_writable_cnt of these are valid. */
     219             :   };
     220             : };
     221             : typedef struct fd_execrp_result fd_execrp_result_t;
     222             : 
     223             : FD_STATIC_ASSERT( sizeof(fd_execrp_result_t)==sizeof(fd_lthash_value_t), execrp_result_sz );
     224             : 
     225             : FD_PROTOTYPES_BEGIN
     226             : 
     227             : FD_FN_CONST static inline ulong
     228           0 : fd_execrp_lthash_msg_sz( ulong cnt ) {
     229           0 :   return offsetof(fd_execrp_lthash_msg_t, acct) + cnt*sizeof(fd_acct_addr_t);
     230           0 : }
     231             : 
     232             : FD_PROTOTYPES_END
     233             : 
     234             : #endif /* HEADER_fd_src_discof_replay_fd_execrp_h */

Generated by: LCOV version 1.14