LCOV - code coverage report
Current view: top level - disco - tiles.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 7 0.0 %
Date: 2026-08-06 05:23:51 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             :   /* An opaque pointer to a Rust Arc<Bank> object, which should only
      24             :      be used with fd_ext_* functions to execute transactions or drop
      25             :      the bank.  The ownership is complicated, but basically any bank
      26             :      tile that receives this frag has a strong refcnt to the bank and
      27             :      should release it when done, other tiles should ignore and never
      28             :      use the bank. */
      29             :   void const * bank;
      30             : 
      31             :   /* In Firedancer, we just pass around the bank_idx which has already
      32             :      been refcounted by the replay tile, rather than a bank pointer. */
      33             :   ulong bank_idx;
      34             : 
      35             :   /* The app-wide bank sequence number of the leader bank (the durable
      36             :      fork discriminator; bank_idx is reused, bank_seq is not).  Used by
      37             :      monitoring (the GUI) to key per-fork transaction history. */
      38             :   ulong bank_seq;
      39             : 
      40             :   /* The maximum number of microblocks that pack is allowed to put
      41             :      into the block. This allows PoH to accurately track and make sure
      42             :      microblocks do not need to be dropped. */
      43             :   ulong max_microblocks_in_slot;
      44             : 
      45             :   /* The number of ticks (effectively empty microblocks) that the PoH
      46             :      tile will put in the block.  This is used to adjust some pack
      47             :      limits. */
      48             :   ulong ticks_per_slot;
      49             : 
      50             :   ulong tick_duration_ns;
      51             : 
      52             :   /* The number of ticks that the PoH tile has skipped, but needs to
      53             :      publish to show peers they were skipped correctly.  This is used
      54             :      to adjust some pack limits. */
      55             :   ulong total_skipped_ticks;
      56             : 
      57             :   /* The number of hashes per tick.  This is used to update the
      58             :      parameter for the proof of history component in case it has
      59             :      changed. */
      60             :   ulong hashcnt_per_tick;
      61             : 
      62             :   /* The epoch of the slot for which we are becoming leader. */
      63             :   ulong epoch;
      64             : 
      65             :   /* Consensus-critical cost limits for the slot we are becoming leader.
      66             :      These are typically unchanging, but may change after a feature
      67             :      activation. */
      68             :   struct {
      69             :     ulong slot_max_cost;
      70             :     ulong slot_max_vote_cost;
      71             :     ulong slot_max_write_cost_per_acct;
      72             :     ulong slot_max_allocated_data_per_block;
      73             :     ulong slot_max_data_shreds;
      74             :   } limits;
      75             : 
      76             :   /* Information from the accounts database as of the start of the slot
      77             :      determined by the bank above that is necessary to crank the bundle
      78             :      tip programs properly.  If bundles are not enabled (determined
      79             :      externally, but the relevant tiles should know), these fields are
      80             :      set to 0. */
      81             :   struct {
      82             :     fd_bundle_crank_tip_payment_config_t config[1];
      83             :     uchar                                tip_receiver_owner[32];
      84             :     uchar                                last_blockhash[32];
      85             :   } bundle[1];
      86             : };
      87             : typedef struct fd_became_leader fd_became_leader_t;
      88             : 
      89             : struct fd_rooted_bank {
      90             :   void * bank;
      91             :   ulong  slot;
      92             : };
      93             : 
      94             : typedef struct fd_rooted_bank fd_rooted_bank_t;
      95             : 
      96             : struct fd_completed_bank {
      97             :    ulong slot;
      98             :    uchar hash[32];
      99             : };
     100             : 
     101             : typedef struct fd_completed_bank fd_completed_bank_t;
     102             : 
     103             : /* fd_txn_ns_dt contains nanosecond offsets for an executed solana
     104             :    transaction relative to the publish event by pack for its
     105             :    corresponding microblock.
     106             : 
     107             :    In Firedancer, these states align with the struct declaration order,
     108             :    but in Frankendancer the "check" phase happens before "load". */
     109             : struct __attribute__((packed)) fd_txn_ns_dt {
     110             :   float load_start;
     111             :   float check_start;
     112             :   float exec_start;
     113             :   float commit_start;
     114             :   float commit_end;
     115             : };
     116             : 
     117             : typedef struct fd_txn_ns_dt fd_txn_ns_dt_t;
     118             : 
     119             : struct fd_microblock_trailer {
     120             :   /* The hash of the transactions in the microblock, ready to be
     121             :      mixed into PoH. */
     122             :   uchar hash[ 32UL ];
     123             : 
     124             :    /* A sequentially increasing index of the first transaction in the
     125             :      microblock, across all slots ever processed by pack.  This is used
     126             :      by monitoring tools that maintain an ordered history of
     127             :      transactions. */
     128             :   ulong pack_txn_idx;
     129             : 
     130             :   /* The tips included in the transaction, in lamports. 0 for non-bundle
     131             :      transactions */
     132             :   ulong tips;
     133             : 
     134             :   /* The app-wide bank sequence number of the bank this microblock was
     135             :      executed against (the durable fork discriminator).  Used by
     136             :      monitoring (the GUI) to key per-fork transaction history. */
     137             :   ulong bank_seq;
     138             : 
     139             :   fd_txn_ns_dt_t txn_ns_dt;
     140             : };
     141             : typedef struct fd_microblock_trailer fd_microblock_trailer_t;
     142             : 
     143             : /* Sentinel sig values for messages on the pack_poh.  Normal
     144             :    done_packing messages use fd_disco_execle_sig( slot, pack_idx ). */
     145           0 : #define FD_PACK_MSG_DONE_DRAINING   (ULONG_MAX)
     146           0 : #define FD_PACK_MSG_REDUCE_MB_BOUND (ULONG_MAX-1UL)
     147             : 
     148           0 : #define FD_PACK_END_SLOT_REASON_TIME          (1)
     149           0 : #define FD_PACK_END_SLOT_REASON_MICROBLOCK    (2)
     150           0 : #define FD_PACK_END_SLOT_REASON_LEADER_SWITCH (3)
     151             : 
     152             : struct fd_done_packing {
     153             :   ulong microblocks_in_slot;
     154             : 
     155             :   fd_pack_limits_usage_t limits_usage[ 1 ];
     156             :   fd_pack_limits_t limits[ 1 ];
     157             : 
     158             :   ulong block_results    [ FD_METRICS_COUNTER_PACK_TXN_SCHEDULED_CNT ];
     159             :   ulong end_block_results[ FD_METRICS_COUNTER_PACK_TXN_SCHEDULED_CNT ];
     160             : 
     161             :   fd_pack_smallest_t pending_smallest[ 1 ];
     162             :   fd_pack_smallest_t pending_votes_smallest[ 1 ];
     163             : 
     164             :   int end_slot_reason;
     165             : };
     166             : typedef struct fd_done_packing fd_done_packing_t;
     167             : 
     168             : struct fd_microblock_execle_trailer {
     169             :   /* An opaque pointer to the bank to use when executing and committing
     170             :      transactions.  The lifetime of the bank is owned by the PoH tile,
     171             :      which guarantees it is valid while pack or bank tiles might be
     172             :      using it. */
     173             :   void const * bank;
     174             : 
     175             :   /* In full Firedancer we just pass an index of the bank in a pool of
     176             :      banks.  The lifetime is fully managed by the replay tile, which has
     177             :      given us a refcount while we are leader for this bank.  bank value
     178             :      above will be NULL. */
     179             :   ulong bank_idx;
     180             : 
     181             :   /* The app-wide bank sequence number of the leader bank (the durable
     182             :      fork discriminator; bank_idx is reused, bank_seq is not).  Used by
     183             :      monitoring (the GUI) to key per-fork transaction history. */
     184             :   ulong bank_seq;
     185             : 
     186             :   /* The sequentially increasing index of the microblock, across all
     187             :      execles.  This is used by PoH to ensure microblocks get committed
     188             :      in the same order they are executed. */
     189             :   ulong microblock_idx;
     190             :   uint  pack_idx;
     191             : 
     192             :   /* A sequentially increasing index of the first transaction in the
     193             :      microblock, across all slots ever processed by pack.  This is used
     194             :      by monitoring tools that maintain an ordered history of
     195             :      transactions. */
     196             :   ulong pack_txn_idx;
     197             : 
     198             :   /* If the microblock is a bundle, with a set of potentially
     199             :      conflicting transactions that should be executed in order, and
     200             :      all either commit or fail atomically. */
     201             :   int is_bundle;
     202             : };
     203             : typedef struct fd_microblock_execle_trailer fd_microblock_execle_trailer_t;
     204             : 
     205             : /* Exact worst-case frag sizes for the pack_execle and execle_poh
     206             :    links.  execle strips the ALT accounts from each fd_txn_e_t before
     207             :    forwarding to poh, so the poh side is smaller. */
     208           0 : #define FD_PACK_EXECLE_MTU (MAX_TXN_PER_MICROBLOCK*sizeof(fd_txn_e_t)+sizeof(fd_microblock_execle_trailer_t))
     209           0 : #define FD_EXECLE_POH_MTU  (MAX_TXN_PER_MICROBLOCK*sizeof(fd_txn_p_t)+sizeof(fd_microblock_trailer_t))
     210             : 
     211             : #endif /* HEADER_fd_src_disco_tiles_h */

Generated by: LCOV version 1.14