LCOV - code coverage report
Current view: top level - disco - fd_txn_p.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 1 9 11.1 %
Date: 2026-10-22 18:10:43 Functions: 0 156 0.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_disco_fd_txn_p_h
       2             : #define HEADER_fd_src_disco_fd_txn_p_h
       3             : 
       4             : #include "../ballet/txn/fd_txn.h"
       5             : #include <stddef.h>
       6             : 
       7             : struct __attribute__((aligned(64))) fd_txn_p {
       8             :   uchar payload[FD_TPU_MTU];
       9             : 
      10             :   /* Keep metadata within 40 bytes so fd_txn_p_t fits in 4992 bytes. */
      11             : 
      12             :   /* Size of payload in bytes, at most FD_TPU_MTU. */
      13             :   ushort payload_sz;
      14             : 
      15             :   /* Source ipv4 address and tpu pipeline for this transaction. TPU is
      16             :      one of FD_TXN_M_TPU_SOURCE_* */
      17             :   uchar source_tpu;
      18             :   uint  source_ipv4;
      19             : 
      20             :   union {
      21             :    struct {
      22             :      uint non_execution_cus;
      23             :      uint requested_exec_plus_acct_data_cus;
      24             :    } pack_cu; /* Populated by pack. Execle reads these to populate the other struct of the union. */
      25             :    struct {
      26             :      uint rebated_cus; /* requested_exec_plus_acct_data_cus-actual used CUs. Pack reads this for CU rebating. */
      27             :      uint actual_consumed_cus; /* non_execution_cus+real execution CUs+real account data cus. PoH reads this for block CU counting. */
      28             :    } execle_cu; /* Populated by execle. */
      29             :    ulong blockhash_height; /* block height provided by resolv tile when txn arrives at the pack tile. Used when txn is in extra storage in pack. */
      30             :   };
      31             :   /* Wallclock nanoseconds at which the transaction arrived to the pack tile. Set by pack and intended to be read from a transaction on a pack->execle link. */
      32             :   long scheduler_arrival_time_nanos;
      33             : 
      34             :   /* Wallclock nanoseconds at which the validator first saw the
      35             :      transaction. */
      36             :   long first_seen_nanos;
      37             : 
      38             :   union {
      39             :     struct {
      40             :       /* set by replay scheduler for use by monitoring tools */
      41             :       ushort start_shred_idx; /* the shred index of the shred containing the first byte of this transaction */
      42             :       ushort end_shred_idx; /* the shred index of the shred containing the byte after the last byte of this transaction, capped at the maximum shred index for this block */
      43             :     };
      44             :     /* pack populates pack_alloc based on an estimate of how many bytes
      45             :        of account data the transaction may allocate.  There should be a
      46             :        field called rebate_alloc, similar to the CU variables, but
      47             :        actually the rebated alloc bytes don't really depend on
      48             :        execution. */
      49             :     uint pack_alloc;
      50             :   };
      51             : 
      52             :   /* Populated by pack, execle.  A combination of the bitfields
      53             :      FD_TXN_P_FLAGS_* defined above.  The execle sets the high byte with
      54             :      the transaction result code. */
      55             :   uint  flags;
      56             :   /* union {
      57             :     This would be ideal but doesn't work because of the flexible array member
      58             :     uchar _[FD_TXN_MAX_SZ];
      59             :     fd_txn_t txn;
      60             :   }; */
      61             :   /* Access with TXN macro below */
      62             :   uchar _[FD_TXN_MAX_SZ] __attribute__((aligned(alignof(fd_txn_t))));
      63             : };
      64             : 
      65             : typedef struct fd_txn_p fd_txn_p_t;
      66             : 
      67             : FD_STATIC_ASSERT( FD_TPU_MTU<=USHORT_MAX, fd_txn_p_payload_sz );
      68             : FD_STATIC_ASSERT( sizeof(fd_txn_p_t)==4992UL, fd_txn_p_layout );
      69             : 
      70      631241 : #define TXN(txn_p) ((fd_txn_t *)( (txn_p)->_ ))
      71             : 
      72             : static inline void
      73             : fd_txn_p_copy( fd_txn_p_t *       dst,
      74           0 :                fd_txn_p_t const * src ) {
      75           0 :   fd_txn_t const * txn = TXN( src );
      76           0 :   ulong meta_off = offsetof(fd_txn_p_t, payload_sz);
      77           0 :   ulong desc_sz  = fd_txn_footprint( txn->instr_cnt, txn->addr_table_lookup_cnt );
      78           0 :   fd_memcpy( dst->payload, src->payload, src->payload_sz );
      79           0 :   fd_memcpy( (uchar *)dst+meta_off, (uchar const *)src+meta_off, offsetof(fd_txn_p_t, _)-meta_off );
      80           0 :   fd_memcpy( dst->_, src->_, desc_sz );
      81           0 : }
      82             : 
      83             : /* fd_txn_e_t: An fd_txn_p_t with expanded address lookup tables */
      84             : struct __attribute__((aligned(64))) fd_txn_e {
      85             :    fd_txn_p_t     txnp[1];
      86             :    fd_acct_addr_t alt_accts[FD_TXN_ACCT_ADDR_MAX]; /* The used account is in the fd_txn_t*/
      87             : };
      88             : 
      89             : typedef struct fd_txn_e fd_txn_e_t;
      90             : 
      91             : #endif /* HEADER_fd_src_disco_fd_txn_p_h */

Generated by: LCOV version 1.14