LCOV - code coverage report
Current view: top level - disco/pack - fd_microblock.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 2 2 100.0 %
Date: 2025-10-13 04:42:14 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_ballet_pack_fd_microblock_h
       2             : #define HEADER_fd_src_ballet_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      844455 : #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             :   int   block_complete;
      32             : 
      33             :   /* Chained merkle root needed by shred tile.  This is the merkle
      34             :      root of the last FEC set of the parent block (that's used as
      35             :      the chaining Merkle root for the first FEC set in the current
      36             :      block).  TODO: Remove. Not a good design. */
      37             :   uchar parent_block_id[ 32 ];
      38             :   uchar parent_block_id_valid;
      39             : };
      40             : typedef struct fd_entry_batch_meta fd_entry_batch_meta_t;
      41             : 
      42             : struct fd_entry_batch_header {
      43             :   /* Number of hashes since the last entry batch that was published,
      44             :      in (0, hashes_per_tick].  Will be hashes_per_tick if and only
      45             :      if there were no microblocks sent between two empty ticks of the
      46             :      PoH. */
      47             :   ulong hashcnt_delta;
      48             : 
      49             :   /* The proof of history stamped hash of the entry batch. */
      50             :   uchar hash[32UL];
      51             : 
      52             :    /* Number of hashes in the entry batch.  Will be 0 for a tick,
      53             :       and (0, MAX_TXN_PER_MICROBLOCK] for a microblock. */
      54             :   ulong txn_cnt;
      55             : };
      56             : typedef struct fd_entry_batch_header fd_entry_batch_header_t;
      57             : 
      58      844455 : #define MAX_TXN_PER_MICROBLOCK ((MAX_MICROBLOCK_SZ-sizeof(fd_entry_batch_meta_t))/sizeof(fd_txn_p_t))
      59             : 
      60             : /* FD_POH_SHRED_MTU is the size of the raw transaction portion of the
      61             :    largest microblock the pack tile will produce, plus the 48B of
      62             :    microblock header (hash and 2 ulongs) plus the fd_entry_batch_meta_t
      63             :    metadata. */
      64             : #define FD_POH_SHRED_MTU (sizeof(fd_entry_batch_meta_t) + sizeof(fd_entry_batch_header_t) + FD_TPU_MTU * MAX_TXN_PER_MICROBLOCK)
      65             : 
      66             : FD_STATIC_ASSERT( FD_POH_SHRED_MTU<=USHORT_MAX, poh_shred_mtu );
      67             : 
      68             : #endif /*HEADER_fd_src_ballet_pack_fd_microblock_h*/

Generated by: LCOV version 1.14