LCOV - code coverage report
Current view: top level - disco - tiles.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 2 7 28.6 %
Date: 2026-11-04 04:26:09 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             :   /* Start and end time of the slot in nanoseconds (from
      19             :      fd_log_wallclock()). */
      20             :   long   slot_start_ns;
      21             :   long   slot_end_ns;
      22             : 
      23             :   /* The bank_idx of the leader bank, which has already been
      24             :      refcounted by the replay tile. */
      25             :   ulong bank_idx;
      26             : 
      27             :   /* The app-wide bank sequence number of the leader bank (the durable
      28             :      fork discriminator; bank_idx is reused, bank_seq is not).  Used by
      29             :      monitoring (the GUI) to key per-fork transaction history. */
      30             :   ulong bank_seq;
      31             : 
      32             :   /* The maximum number of microblocks that pack is allowed to put
      33             :      into the block. This allows PoH to accurately track and make sure
      34             :      microblocks do not need to be dropped. */
      35             :   ulong max_microblocks_in_slot;
      36             : 
      37             :   /* The number of ticks (effectively empty microblocks) that the PoH
      38             :      tile will put in the block.  This is used to adjust some pack
      39             :      limits. */
      40             :   ulong ticks_per_slot;
      41             : 
      42             :   ulong tick_duration_ns;
      43             : 
      44             :   /* The number of ticks that the PoH tile has skipped, but needs to
      45             :      publish to show peers they were skipped correctly.  This is used
      46             :      to adjust some pack limits. */
      47             :   ulong total_skipped_ticks;
      48             : 
      49             :   /* The number of hashes per tick.  This is used to update the
      50             :      parameter for the proof of history component in case it has
      51             :      changed. */
      52             :   ulong hashcnt_per_tick;
      53             : 
      54             :   /* The epoch of the slot for which we are becoming leader. */
      55             :   ulong epoch;
      56             : 
      57             :   /* The block height of the slot for which we are becoming leader. */
      58             :   ulong block_height;
      59             : 
      60             :   /* Consensus-critical cost limits for the slot we are becoming leader.
      61             :      These are typically unchanging, but may change after a feature
      62             :      activation. */
      63             :   struct {
      64             :     ulong slot_max_cost;
      65             :     ulong slot_max_write_cost_per_acct;
      66             :     ulong slot_max_allocated_data_per_block;
      67             :     ulong slot_max_data_shreds;
      68             :   } limits;
      69             : 
      70             :   /* Information from the accounts database as of the start of the slot
      71             :      determined by the bank above that is necessary to crank the bundle
      72             :      tip programs properly.  If bundles are not enabled (determined
      73             :      externally, but the relevant tiles should know), these fields are
      74             :      set to 0. */
      75             :   struct {
      76             :     fd_bundle_crank_tip_payment_config_t config[1];
      77             :     uchar                                tip_receiver_owner[32];
      78             :     uchar                                last_blockhash[32];
      79             :   } bundle[1];
      80             : };
      81             : typedef struct fd_became_leader fd_became_leader_t;
      82             : 
      83             : /* fd_txn_ns_dt contains nanosecond offsets for an executed solana
      84             :    transaction relative to the publish event by pack for its
      85             :    corresponding microblock.  These states align with the struct
      86             :    declaration order. */
      87             : struct __attribute__((packed)) fd_txn_ns_dt {
      88             :   float load_start;
      89             :   float check_start;
      90             :   float exec_start;
      91             :   float commit_start;
      92             :   float commit_end;
      93             : };
      94             : 
      95             : typedef struct fd_txn_ns_dt fd_txn_ns_dt_t;
      96             : 
      97             : struct fd_microblock_trailer {
      98             :   /* The hash of the transactions in the microblock, ready to be
      99             :      mixed into PoH. */
     100             :   uchar hash[ 32UL ];
     101             : 
     102             :    /* A sequentially increasing index of the first transaction in the
     103             :      microblock, across all slots ever processed by pack.  This is used
     104             :      by monitoring tools that maintain an ordered history of
     105             :      transactions. */
     106             :   ulong pack_txn_idx;
     107             : 
     108             :   /* The tips included in the transaction, in lamports. 0 for non-bundle
     109             :      transactions */
     110             :   ulong tips;
     111             : 
     112             :   /* The app-wide bank sequence number of the bank this microblock was
     113             :      executed against (the durable fork discriminator).  Used by
     114             :      monitoring (the GUI) to key per-fork transaction history. */
     115             :   ulong bank_seq;
     116             : 
     117             :   fd_txn_ns_dt_t txn_ns_dt;
     118             : 
     119             :   /* When the exec tile began executing this microblock (for a bundle,
     120             :      the bundle start) and when its transaction finished committing
     121             :      (LONG_MAX if nothing committed). */
     122             :   long exec_start_ticks;
     123             :   long exec_end_ticks;
     124             : };
     125             : typedef struct fd_microblock_trailer fd_microblock_trailer_t;
     126             : 
     127             : /* Sentinel sig values for messages on the pack_poh.  Normal
     128             :    done_packing messages use fd_disco_execle_sig( slot, pack_idx ). */
     129           0 : #define FD_PACK_MSG_DONE_DRAINING   (ULONG_MAX)
     130           0 : #define FD_PACK_MSG_REDUCE_MB_BOUND (ULONG_MAX-1UL)
     131             : 
     132          12 : #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           3 : #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