LCOV - code coverage report
Current view: top level - disco - tiles.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 6 0.0 %
Date: 2026-11-26 02:16:43 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_disco_tiles_h
       2             : #define HEADER_fd_src_disco_tiles_h
       3             : 
       4             : #include "stem/fd_stem.h"
       5             : #include "shred/fd_shredder.h"
       6             : #include "../ballet/shred/fd_shred.h"
       7             : #include "../flamenco/leaders/fd_leaders_base.h"
       8             : #include "pack/fd_pack.h"
       9             : #include "topo/fd_topo.h"
      10             : #include "bundle/fd_bundle_crank.h"
      11             : #include "../disco/metrics/generated/fd_metrics_pack.h"
      12             : 
      13             : #include <linux/filter.h>
      14             : 
      15             : struct fd_became_leader {
      16             :    ulong slot;
      17             : 
      18             :   /* The parent block the leader slot builds on. parent_cmr is the
      19             :      merkle root of the parent's last FEC set, which chains our first
      20             :      FEC set.  parent_dmr is the parent's double merkle root (block id),
      21             :      which goes in the block header.  parent_blockhash is the parent's
      22             :      last blockhash (its alpentick). */
      23             : 
      24             :   ulong     parent_slot;
      25             :   fd_hash_t parent_cmr;
      26             :   fd_hash_t parent_dmr;
      27             :   fd_hash_t parent_blockhash;
      28             : 
      29             :   /* Start and end time of the slot in nanoseconds (from
      30             :      fd_log_wallclock()). */
      31             :   long   slot_start_ns;
      32             :   long   slot_end_ns;
      33             : 
      34             :   /* The bank_idx of the leader bank, which has already been
      35             :      refcounted by the replay tile. */
      36             :   ulong bank_idx;
      37             : 
      38             :   /* The app-wide bank sequence number of the leader bank (the durable
      39             :      fork discriminator; bank_idx is reused, bank_seq is not).  Used by
      40             :      monitoring (the GUI) to key per-fork transaction history. */
      41             :   ulong bank_seq;
      42             : 
      43             :   /* The maximum number of microblocks that pack is allowed to put
      44             :      into the block. This allows PoH to accurately track and make sure
      45             :      microblocks do not need to be dropped. */
      46             :   ulong max_microblocks_in_slot;
      47             : 
      48             :   /* The number of ticks (effectively empty microblocks) that the PoH
      49             :      tile will put in the block.  This is used to adjust some pack
      50             :      limits. */
      51             :   ulong ticks_per_slot;
      52             : 
      53             :   ulong tick_duration_ns;
      54             : 
      55             :   /* The epoch of the slot for which we are becoming leader. */
      56             :   ulong epoch;
      57             : 
      58             :   /* The block height of the slot for which we are becoming leader. */
      59             :   ulong block_height;
      60             : 
      61             :   /* Consensus-critical cost limits for the slot we are becoming leader.
      62             :      These are typically unchanging, but may change after a feature
      63             :      activation. */
      64             :   struct {
      65             :     ulong slot_max_cost;
      66             :     ulong slot_max_write_cost_per_acct;
      67             :     ulong slot_max_allocated_data_per_block;
      68             :     ulong slot_max_data_shreds;
      69             :   } limits;
      70             : 
      71             :   /* Information from the accounts database as of the start of the slot
      72             :      determined by the bank above that is necessary to crank the bundle
      73             :      tip programs properly.  If bundles are not enabled (determined
      74             :      externally, but the relevant tiles should know), these fields are
      75             :      set to 0. */
      76             :   struct {
      77             :     fd_bundle_crank_tip_payment_config_t config[1];
      78             :     uchar                                tip_receiver_owner[32];
      79             :     uchar                                last_blockhash[32];
      80             :   } bundle[1];
      81             : };
      82             : typedef struct fd_became_leader fd_became_leader_t;
      83             : 
      84             : /* fd_txn_ns_dt contains nanosecond offsets for an executed solana
      85             :    transaction relative to the publish event by pack for its
      86             :    corresponding microblock.  These states align with the struct
      87             :    declaration order. */
      88             : struct __attribute__((packed)) fd_txn_ns_dt {
      89             :   float load_start;
      90             :   float check_start;
      91             :   float exec_start;
      92             :   float commit_start;
      93             :   float commit_end;
      94             : };
      95             : 
      96             : typedef struct fd_txn_ns_dt fd_txn_ns_dt_t;
      97             : 
      98             : struct fd_microblock_trailer {
      99             :   /* The hash of the transactions in the microblock, ready to be
     100             :      mixed into PoH. */
     101             :   uchar hash[ 32UL ];
     102             : 
     103             :    /* A sequentially increasing index of the first transaction in the
     104             :      microblock, across all slots ever processed by pack.  This is used
     105             :      by monitoring tools that maintain an ordered history of
     106             :      transactions. */
     107             :   ulong pack_txn_idx;
     108             : 
     109             :   /* The tips included in the transaction, in lamports. 0 for non-bundle
     110             :      transactions */
     111             :   ulong tips;
     112             : 
     113             :   /* The app-wide bank sequence number of the bank this microblock was
     114             :      executed against (the durable fork discriminator).  Used by
     115             :      monitoring (the GUI) to key per-fork transaction history. */
     116             :   ulong bank_seq;
     117             : 
     118             :   fd_txn_ns_dt_t txn_ns_dt;
     119             : 
     120             :   /* When the exec tile began executing this microblock (for a bundle,
     121             :      the bundle start) and when its transaction finished committing
     122             :      (LONG_MAX if nothing committed). */
     123             :   long exec_start_ticks;
     124             :   long exec_end_ticks;
     125             : };
     126             : typedef struct fd_microblock_trailer fd_microblock_trailer_t;
     127             : 
     128             : /* Sentinel sig values for messages on the pack_poh.  Normal
     129             :    done_packing messages use fd_disco_execle_sig( slot, pack_idx ). */
     130           0 : #define FD_PACK_MSG_DONE_DRAINING   (ULONG_MAX)
     131             : 
     132           0 : #define FD_PACK_END_SLOT_REASON_TIME       (1)
     133           0 : #define FD_PACK_END_SLOT_REASON_MICROBLOCK (2)
     134           0 : #define FD_PACK_END_SLOT_REASON_ABANDONED  (3)
     135             : 
     136             : struct fd_done_packing {
     137             :   ulong microblocks_in_slot;
     138             : 
     139             :   fd_pack_limits_usage_t limits_usage[ 1 ];
     140             :   fd_pack_limits_t limits[ 1 ];
     141             : 
     142             :   ulong block_results    [ FD_METRICS_COUNTER_PACK_TXN_SCHEDULE_ATTEMPTED_CNT ];
     143             :   ulong end_block_results[ FD_METRICS_COUNTER_PACK_TXN_SCHEDULE_ATTEMPTED_CNT ];
     144             : 
     145             :   fd_pack_smallest_t pending_smallest[ 1 ];
     146             : 
     147             :   int end_slot_reason;
     148             : 
     149             :   long  pack_start_ns;
     150             :   long  pack_end_ns;
     151             :   ulong bundle_txn_count;
     152             : };
     153             : typedef struct fd_done_packing fd_done_packing_t;
     154             : 
     155             : struct fd_microblock_execle_trailer {
     156             :   /* The index of the bank in a pool of banks.  The lifetime is fully
     157             :      managed by the replay tile, which has given us a refcount while we
     158             :      are leader for this bank. */
     159             :   ulong bank_idx;
     160             : 
     161             :   /* The app-wide bank sequence number of the leader bank (the durable
     162             :      fork discriminator; bank_idx is reused, bank_seq is not).  Used by
     163             :      monitoring (the GUI) to key per-fork transaction history. */
     164             :   ulong bank_seq;
     165             : 
     166             :   /* The sequentially increasing index of the microblock, across all
     167             :      execles.  This is used by PoH to ensure microblocks get committed
     168             :      in the same order they are executed. */
     169             :   ulong microblock_idx;
     170             :   uint  pack_idx;
     171             : 
     172             :   /* A sequentially increasing index of the first transaction in the
     173             :      microblock, across all slots ever processed by pack.  This is used
     174             :      by monitoring tools that maintain an ordered history of
     175             :      transactions. */
     176             :   ulong pack_txn_idx;
     177             : 
     178             :   /* If the microblock is a bundle, with a set of potentially
     179             :      conflicting transactions that should be executed in order, and
     180             :      all either commit or fail atomically. */
     181             :   int is_bundle;
     182             : };
     183             : typedef struct fd_microblock_execle_trailer fd_microblock_execle_trailer_t;
     184             : 
     185             : /* Exact worst-case frag sizes for the pack_execle and execle_poh
     186             :    links.  execle strips the ALT accounts from each fd_txn_e_t before
     187             :    forwarding to poh, so the poh side is smaller. */
     188           0 : #define FD_PACK_EXECLE_MTU (MAX_TXN_PER_MICROBLOCK*sizeof(fd_txn_e_t)+sizeof(fd_microblock_execle_trailer_t))
     189           0 : #define FD_EXECLE_POH_MTU  (MAX_TXN_PER_MICROBLOCK*sizeof(fd_txn_p_t)+sizeof(fd_microblock_trailer_t))
     190             : 
     191             : #endif /* HEADER_fd_src_disco_tiles_h */

Generated by: LCOV version 1.14