LCOV - code coverage report
Current view: top level - disco - tiles.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 5 0.0 %
Date: 2026-05-28 08:30:14 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 maximum number of microblocks that pack is allowed to put
      36             :      into the block. This allows PoH to accurately track and make sure
      37             :      microblocks do not need to be dropped. */
      38             :   ulong max_microblocks_in_slot;
      39             : 
      40             :   /* The number of ticks (effectively empty microblocks) that the PoH
      41             :      tile will put in the block.  This is used to adjust some pack
      42             :      limits. */
      43             :   ulong ticks_per_slot;
      44             : 
      45             :   ulong tick_duration_ns;
      46             : 
      47             :   /* The number of ticks that the PoH tile has skipped, but needs to
      48             :      publish to show peers they were skipped correctly.  This is used
      49             :      to adjust some pack limits. */
      50             :   ulong total_skipped_ticks;
      51             : 
      52             :   /* The number of hashes per tick.  This is used to update the
      53             :      parameter for the proof of history component in case it has
      54             :      changed. */
      55             :   ulong hashcnt_per_tick;
      56             : 
      57             :   /* The epoch of the slot for which we are becoming leader. */
      58             :   ulong epoch;
      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_vote_cost;
      66             :     ulong slot_max_write_cost_per_acct;
      67             :   } limits;
      68             : 
      69             :   /* Information from the accounts database as of the start of the slot
      70             :      determined by the bank above that is necessary to crank the bundle
      71             :      tip programs properly.  If bundles are not enabled (determined
      72             :      externally, but the relevant tiles should know), these fields are
      73             :      set to 0. */
      74             :   struct {
      75             :     fd_bundle_crank_tip_payment_config_t config[1];
      76             :     uchar                                tip_receiver_owner[32];
      77             :     uchar                                last_blockhash[32];
      78             :   } bundle[1];
      79             : };
      80             : typedef struct fd_became_leader fd_became_leader_t;
      81             : 
      82             : struct fd_rooted_bank {
      83             :   void * bank;
      84             :   ulong  slot;
      85             : };
      86             : 
      87             : typedef struct fd_rooted_bank fd_rooted_bank_t;
      88             : 
      89             : struct fd_completed_bank {
      90             :    ulong slot;
      91             :    uchar hash[32];
      92             : };
      93             : 
      94             : typedef struct fd_completed_bank fd_completed_bank_t;
      95             : 
      96             : /* fd_txn_ns_dt contains nanosecond offsets for an executed solana
      97             :    transaction relative to the publish event by pack for its
      98             :    corresponding microblock.
      99             : 
     100             :    In Firedancer, these states align with the struct declaration order,
     101             :    but in Frankendancer the "check" phase happens before "load". */
     102             : struct __attribute__((packed)) fd_txn_ns_dt {
     103             :   float load_start;
     104             :   float check_start;
     105             :   float exec_start;
     106             :   float commit_start;
     107             :   float commit_end;
     108             : };
     109             : 
     110             : typedef struct fd_txn_ns_dt fd_txn_ns_dt_t;
     111             : 
     112             : struct fd_microblock_trailer {
     113             :   /* The hash of the transactions in the microblock, ready to be
     114             :      mixed into PoH. */
     115             :   uchar hash[ 32UL ];
     116             : 
     117             :    /* A sequentially increasing index of the first transaction in the
     118             :      microblock, across all slots ever processed by pack.  This is used
     119             :      by monitoring tools that maintain an ordered history of
     120             :      transactions. */
     121             :   ulong pack_txn_idx;
     122             : 
     123             :   /* The tips included in the transaction, in lamports. 0 for non-bundle
     124             :      transactions */
     125             :   ulong tips;
     126             : 
     127             :   fd_txn_ns_dt_t txn_ns_dt;
     128             : };
     129             : typedef struct fd_microblock_trailer fd_microblock_trailer_t;
     130             : 
     131             : /* Sentinel sig values for messages on the pack_poh.  Normal
     132             :    done_packing messages use fd_disco_execle_sig( slot, pack_idx ). */
     133           0 : #define FD_PACK_MSG_DONE_DRAINING   (ULONG_MAX)
     134           0 : #define FD_PACK_MSG_REDUCE_MB_BOUND (ULONG_MAX-1UL)
     135             : 
     136           0 : #define FD_PACK_END_SLOT_REASON_TIME          (1)
     137           0 : #define FD_PACK_END_SLOT_REASON_MICROBLOCK    (2)
     138           0 : #define FD_PACK_END_SLOT_REASON_LEADER_SWITCH (3)
     139             : 
     140             : struct fd_done_packing {
     141             :   ulong microblocks_in_slot;
     142             : 
     143             :   fd_pack_limits_usage_t limits_usage[ 1 ];
     144             :   fd_pack_limits_t limits[ 1 ];
     145             : 
     146             :   ulong block_results    [ FD_METRICS_COUNTER_PACK_TRANSACTION_SCHEDULE_CNT ];
     147             :   ulong end_block_results[ FD_METRICS_COUNTER_PACK_TRANSACTION_SCHEDULE_CNT ];
     148             : 
     149             :   fd_pack_smallest_t pending_smallest[ 1 ];
     150             :   fd_pack_smallest_t pending_votes_smallest[ 1 ];
     151             : 
     152             :   int end_slot_reason;
     153             : };
     154             : typedef struct fd_done_packing fd_done_packing_t;
     155             : 
     156             : struct fd_microblock_execle_trailer {
     157             :   /* An opaque pointer to the bank to use when executing and committing
     158             :      transactions.  The lifetime of the bank is owned by the PoH tile,
     159             :      which guarantees it is valid while pack or bank tiles might be
     160             :      using it. */
     161             :   void const * bank;
     162             : 
     163             :   /* In full Firedancer we just pass an index of the bank in a pool of
     164             :      banks.  The lifetime is fully managed by the replay tile, which has
     165             :      given us a refcount while we are leader for this bank.  bank value
     166             :      above will be NULL. */
     167             :   ulong bank_idx;
     168             : 
     169             :   /* The sequentially increasing index of the microblock, across all
     170             :      execles.  This is used by PoH to ensure microblocks get committed
     171             :      in the same order they are executed. */
     172             :   ulong microblock_idx;
     173             :   uint  pack_idx;
     174             : 
     175             :   /* A sequentially increasing index of the first transaction in the
     176             :      microblock, across all slots ever processed by pack.  This is used
     177             :      by monitoring tools that maintain an ordered history of
     178             :      transactions. */
     179             :   ulong pack_txn_idx;
     180             : 
     181             :   /* If the microblock is a bundle, with a set of potentially
     182             :      conflicting transactions that should be executed in order, and
     183             :      all either commit or fail atomically. */
     184             :   int is_bundle;
     185             : };
     186             : typedef struct fd_microblock_execle_trailer fd_microblock_execle_trailer_t;
     187             : 
     188             : #endif /* HEADER_fd_src_disco_tiles_h */

Generated by: LCOV version 1.14