LCOV - code coverage report
Current view: top level - disco/pack - fd_microblock.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 2 4 50.0 %
Date: 2026-09-17 04:28:31 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_disco_pack_fd_microblock_h
       2             : #define HEADER_fd_src_disco_pack_fd_microblock_h
       3             : 
       4             : #include "../fd_txn_p.h"
       5             : 
       6             : /* in bytes.  Defined this way to use the size field of mcache.  This
       7             :    only includes the transaction payload and the fd_txn_t portions of
       8             :    the microblock, as all the other portions (hash, etc) are generated
       9             :    by PoH later. */
      10           0 : #define MAX_MICROBLOCK_SZ USHORT_MAX
      11             : 
      12             : struct fd_entry_batch_meta {
      13             :   /* How many skipped slots we are building on top of.  If there were no
      14             :      skipped slots, (aka: this is slot 10, and the reset slot is slot 9,
      15             :      then the value should be 1). */
      16             :   ulong parent_offset;
      17             : 
      18             :   /* Tick in the slot indexed from [0, ticks_per_slot].  For ticks,
      19             :      which are sent ever 12,500 hashes, this will be 1 for the first
      20             :      tick, then 2, ... up to and including tick 64 for the last one.
      21             : 
      22             :      For microblocks, it will be 0 for microblocks that are sent before
      23             :      the first tick, etc, up to and including 63.  The range of allowed
      24             :      reference ticks is thus [0, 64], but can only be 0 for a microblock
      25             :      and can only be 64 for the last tick (when block_complete is true). */
      26             :   ulong reference_tick;
      27             : 
      28             :   /* Whether this is the last microblock in the slot or not.  The last
      29             :      microblock will always be an empty tick with no transactions in
      30             :      it.
      31             : 
      32             :      For backwards compatibility with pre-Alpenglow code, block_complete
      33             :      is defined in the following way when Alpenglow is enabled:
      34             : 
      35             :      header     -1  a complete entry batch of its own, and the first
      36             :                     frag of the slot, because the shred tile chains the
      37             :                     block off the parent block id carried by the first
      38             :                     frag it sees for the slot
      39             :      entries     0  ordinary microblocks, passed through from pack
      40             :      footer     -1
      41             :      alpentick   1  the last frag of the slot */
      42             :   int   block_complete;
      43             : 
      44             :   /* Chained merkle root needed by shred tile.  This is the merkle
      45             :      root of the last FEC set of the parent block (that's used as
      46             :      the chaining Merkle root for the first FEC set in the current
      47             :      block).  TODO: Remove. Not a good design. */
      48             :   uchar parent_block_id[ 32 ];
      49             :   uchar parent_block_id_valid;
      50             : };
      51             : typedef struct fd_entry_batch_meta fd_entry_batch_meta_t;
      52             : 
      53             : struct fd_entry_batch_header {
      54             :   /* Number of hashes since the last entry batch that was published,
      55             :      in (0, hashes_per_tick].  Will be hashes_per_tick if and only
      56             :      if there were no microblocks sent between two empty ticks of the
      57             :      PoH. */
      58             :   ulong hashcnt_delta;
      59             : 
      60             :   /* The proof of history stamped hash of the entry batch. */
      61             :   uchar hash[32UL];
      62             : 
      63             :    /* Number of hashes in the entry batch.  Will be 0 for a tick,
      64             :       and (0, MAX_TXN_PER_MICROBLOCK] for a microblock. */
      65             :   ulong txn_cnt;
      66             : };
      67             : typedef struct fd_entry_batch_header fd_entry_batch_header_t;
      68             : 
      69             : /* Pack emits one transaction per ordinary microblock, but bundles may
      70             :    contain up to five transactions. */
      71         195 : #define MAX_TXN_PER_MICROBLOCK (5UL)
      72             : 
      73             : /* A bundle is a sequence of between 1 and FD_PACK_MAX_TXN_PER_BUNDLE
      74             :    transactions (both inclusive) that executes and commits atomically. */
      75       14943 : #define FD_PACK_MAX_TXN_PER_BUNDLE (5UL)
      76             : FD_STATIC_ASSERT( FD_PACK_MAX_TXN_PER_BUNDLE<=MAX_TXN_PER_MICROBLOCK, bundle_fits_microblock );
      77             : 
      78             : /* FD_POH_SHRED_MTU is the size of the raw transaction portion of the
      79             :    largest microblock the pack tile will produce, plus the 48B of
      80             :    microblock header (hash and 2 ulongs) plus the fd_entry_batch_meta_t
      81             :    metadata. */
      82           0 : #define FD_POH_SHRED_MTU (sizeof(fd_entry_batch_meta_t) + sizeof(fd_entry_batch_header_t) + FD_TPU_MTU * MAX_TXN_PER_MICROBLOCK)
      83             : 
      84             : FD_STATIC_ASSERT( FD_POH_SHRED_MTU<=USHORT_MAX, poh_shred_mtu );
      85             : 
      86             : #endif /*HEADER_fd_src_disco_pack_fd_microblock_h */

Generated by: LCOV version 1.14