LCOV - code coverage report
Current view: top level - discof/replay - fd_sched.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 10 35 28.6 %
Date: 2026-08-16 04:31:21 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_discof_replay_fd_sched_h
       2             : #define HEADER_fd_src_discof_replay_fd_sched_h
       3             : 
       4             : #include "fd_rdisp.h"
       5             : #include "../../disco/fd_txn_p.h"
       6             : #include "../../disco/store/fd_store.h" /* for fd_store_fec_t */
       7             : #include "../../flamenco/accdb/fd_accdb.h"
       8             : 
       9             : /* fd_sched wraps all the smarts and mechanical chores around scheduling
      10             :    transactions for replay execution.  It is built on top of the
      11             :    dispatcher fd_rdisp.  The dispatcher is responsible for high
      12             :    performance lane-based scheduling of transactions.  On top of that,
      13             :    we add fork-aware management of lanes, and policies regarding which
      14             :    lanes to prioritize for execution.
      15             : 
      16             :    Conceptually, transactions in a block form a DAG.  We would like to
      17             :    make our way through a block with a sufficient degree of parallelism,
      18             :    such that the execution time of the critical path of the DAG is the
      19             :    limiting factor.  The dispatcher does a good job of emerging the
      20             :    critical path of the DAG on the fly.  Blocks are tracked by the
      21             :    dispatcher either as a block staged on a lane, or as an unstaged
      22             :    block.  When a block is staged, it will enjoy the most intelligent
      23             :    online scheduling that the dispatcher has to offer.  Lanes have to
      24             :    consist of linear chains of blocks down a fork.  So to map a fork
      25             :    tree to lanes, we will need multiple lanes.  Ideally, every branch in
      26             :    the fork tree sits on some lane.  However, memory footprint limits us
      27             :    to a few number of lanes.
      28             : 
      29             :    This module implements a state machine for ensuring that blocks enter
      30             :    into and exit out of lanes in an orderly fashion.  The public APIs of
      31             :    this module are invoked to drive state transitions on a small number
      32             :    of events, such as new transactions arriving, or transactions
      33             :    completing, or a block being aborted/abandoned.  We also implement
      34             :    policies for deciding which blocks get staged onto lanes, or evicted
      35             :    from lanes, as well as which lanes to prioritize for execution.
      36             : 
      37             : 
      38             :    The general order in which calls happen under the normal case is:
      39             : 
      40             :    fd_sched_fec_ingest()* ... fd_sched_txn_next_ready()* ... fd_sched_txn_done()* ...
      41             :    more ingest, more ready, more done ...
      42             :    ...
      43             :    fd_sched_txn_next_ready() indicates that the last transaction in the block is being scheduled
      44             :    fd_sched_txn_done()*
      45             :    fd_sched_block_is_done()
      46             :    end-of-block processing in caller
      47             :    fd_sched_txn_next_ready() starts returning transactions from the next block
      48             :    more ingest, more ready, more done ...
      49             :    ... */
      50             : 
      51          12 : #define FD_SCHED_MIN_DEPTH 478
      52             : #define FD_SCHED_MAX_DEPTH FD_RDISP_MAX_DEPTH
      53             : 
      54             : struct fd_sched;
      55             : typedef struct fd_sched fd_sched_t;
      56             : 
      57             : struct fd_sched_alut_ctx {
      58             :   fd_accdb_t *       accdb;
      59             :   fd_accdb_fork_id_t fork_id;
      60             :   ulong              els; /* Effective lookup slot. */
      61             : };
      62             : typedef struct fd_sched_alut_ctx fd_sched_alut_ctx_t;
      63             : 
      64             : struct fd_sched_fec {
      65             :   ulong            bank_idx;            /* Index of the block.  Assumed to be in [0, block_cnt_max).  Caller
      66             :                                            is responsible for ensuring that bank idx is in bounds and unique
      67             :                                            across equivocated blocks. */
      68             :   ulong            parent_bank_idx;     /* Index of the parent block.  Assumed to be in [0, block_cnt_max).
      69             :                                            Caller is responsible for ensuring that parent bank idx is in
      70             :                                            bounds and unique across equivocated blocks. */
      71             :   ulong            slot;                /* Slot number of the block. */
      72             :   ulong            parent_slot;         /* Slot number of the parent block. */
      73             :   fd_store_fec_t * fec;                 /* FEC set metadata. */
      74             :   uchar          * data;                /* Resolved laddr of the FEC set data buffer. */
      75             :   uint             shred_cnt;           /* Number of shreds in the FEC set. */
      76             :   uint             is_last_in_batch:1;  /* Set if this is the last FEC set in the batch; relevant because the
      77             :                                            parser should ignore trailing bytes at the end of a batch. */
      78             :   uint             is_last_in_block:1;  /* Set if this is the last FEC set in the block. */
      79             :   uint             is_first_in_block:1; /* Set if this is the first FEC set in the block.  Bank should increment refcnt for sched if such a FEC set has been ingested by sched. */
      80             : 
      81             :   fd_sched_alut_ctx_t alut_ctx[ 1 ];
      82             : };
      83             : typedef struct fd_sched_fec fd_sched_fec_t;
      84             : 
      85             : /* The state of a transaction.  Non mutually exclusive. */
      86           0 : #define FD_SCHED_TXN_EXEC_DONE      (0x0001UL)
      87           0 : #define FD_SCHED_TXN_SIGVERIFY_DONE (0x0002UL)
      88           0 : #define FD_SCHED_TXN_IS_COMMITTABLE (0x0004UL)
      89           0 : #define FD_SCHED_TXN_IS_FEES_ONLY   (0x0008UL)
      90             : #define FD_SCHED_TXN_REPLAY_DONE    (FD_SCHED_TXN_EXEC_DONE|FD_SCHED_TXN_SIGVERIFY_DONE)
      91             : 
      92             : struct fd_sched_txn_info {
      93             :    ulong flags;
      94             :    int   txn_err;
      95             :    long  tick_parsed;
      96             :    long  tick_sigverify_disp;
      97             :    long  tick_sigverify_done;
      98             :    long  tick_exec_disp;
      99             :    long  tick_exec_done;
     100             :    ulong index_in_slot; /* 0-indexed position of this transaction within its block. */
     101             : };
     102             : typedef struct fd_sched_txn_info fd_sched_txn_info_t;
     103             : 
     104             : /* The scheduler may return one of the following types of tasks for the
     105             :    replay tile.
     106             : 
     107             :    e - passed down to exec tiles.
     108             :    i - replay completes the task immediately.
     109             :    q - replay may either do it immediately or queue the task up. */
     110          36 : #define FD_SCHED_TT_NULL          (0UL)
     111          72 : #define FD_SCHED_TT_BLOCK_START   (1UL) /* (i) Start-of-block processing. */
     112          24 : #define FD_SCHED_TT_BLOCK_END     (2UL) /* (q) End-of-block processing. */
     113           0 : #define FD_SCHED_TT_TXN_EXEC      (3UL) /* (e) Transaction execution. */
     114           0 : #define FD_SCHED_TT_TXN_SIGVERIFY (4UL) /* (e) Transaction sigverify. */
     115             : #define FD_SCHED_TT_LTHASH        (5UL) /* (e) Account lthash. */
     116          45 : #define FD_SCHED_TT_POH_HASH      (6UL) /* (e) PoH hashing. */
     117           6 : #define FD_SCHED_TT_MARK_DEAD     (7UL) /* (i) Mark the block dead. */
     118             : 
     119             : struct fd_sched_block_start {
     120             :   ulong bank_idx;        /* Same as in fd_sched_fec_t. */
     121             :   ulong parent_bank_idx; /* Same as in fd_sched_fec_t. */
     122             :   ulong slot;            /* Slot number of the block. */
     123             : };
     124             : typedef struct fd_sched_block_start fd_sched_block_start_t;
     125             : 
     126             : struct fd_sched_block_end {
     127             :   ulong bank_idx;
     128             : };
     129             : typedef struct fd_sched_block_end fd_sched_block_end_t;
     130             : 
     131             : struct fd_sched_txn_exec {
     132             :   ulong bank_idx;
     133             :   ulong slot;
     134             :   ulong txn_idx;
     135             :   ulong exec_idx;
     136             : };
     137             : typedef struct fd_sched_txn_exec fd_sched_txn_exec_t;
     138             : 
     139             : struct fd_sched_txn_sigverify {
     140             :   ulong bank_idx;
     141             :   ulong txn_idx;
     142             :   ulong exec_idx;
     143             : };
     144             : typedef struct fd_sched_txn_sigverify fd_sched_txn_sigverify_t;
     145             : 
     146             : struct fd_sched_poh_hash {
     147             :   ulong     bank_idx;
     148             :   ulong     mblk_idx;
     149             :   ulong     exec_idx;
     150             :   ulong     hashcnt;
     151             :   fd_hash_t hash[ 1 ];
     152             : };
     153             : typedef struct fd_sched_poh_hash fd_sched_poh_hash_t;
     154             : 
     155          63 : #define FD_SCHED_DEAD_REASON_NONE                       (0)  /* Block was not ruled invalid by the scheduler. */
     156           0 : #define FD_SCHED_DEAD_REASON_UNFINISHED_ENTRIES         (1)  /* A new microblock run began while the previously announced microblocks had not fully parsed out of the bytes. */
     157           0 : #define FD_SCHED_DEAD_REASON_UNPARSEABLE_CONTENT        (2)  /* Bytes at the head of the stream failed to parse out as any structure (transaction, microblock header, or count) within the largest size a valid block allows: garbage or oversized content. */
     158           0 : #define FD_SCHED_DEAD_REASON_TRUNCATED_ENTRIES          (3)  /* Block bytes ended short of the microblocks and transactions announced. */
     159           0 : #define FD_SCHED_DEAD_REASON_TRAILING_ENTRY             (4)  /* Block did not end on a tick. */
     160           0 : #define FD_SCHED_DEAD_REASON_TOO_MANY_MICROBLOCKS       (5)  /* More microblocks than a valid block can hold. */
     161           0 : #define FD_SCHED_DEAD_REASON_TOO_MANY_TXNS_ANNOUNCED    (6)  /* Microblock header announced more transactions than a valid block can hold. */
     162           0 : #define FD_SCHED_DEAD_REASON_TICK_HASHES_OVERFLOW       (7)  /* Microblock header announced more hashes than fit before the next tick. */
     163           0 : #define FD_SCHED_DEAD_REASON_INCONSISTENT_TICK_HASHES   (8)  /* Tick hash count differs from the block's preceding ticks. */
     164           0 : #define FD_SCHED_DEAD_REASON_ZERO_HASH_TICK             (9)  /* Tick advanced zero hashes. */
     165           0 : #define FD_SCHED_DEAD_REASON_TOO_MANY_MICROBLOCKS_ANNOUNCED (10) /* Microblock count announced more microblocks than a valid block can hold. */
     166           0 : #define FD_SCHED_DEAD_REASON_ZERO_MICROBLOCKS           (11) /* A microblock count announced zero microblocks. */
     167           0 : #define FD_SCHED_DEAD_REASON_TOO_MANY_TXNS              (12) /* More transactions than a valid block can hold. */
     168           0 : #define FD_SCHED_DEAD_REASON_DUPLICATE_ACCOUNT          (13) /* Transaction referenced the same account more than once. */
     169           6 : #define FD_SCHED_DEAD_REASON_TOO_MANY_TICKS             (14) /* More ticks than allowed. */
     170           0 : #define FD_SCHED_DEAD_REASON_ZERO_HASH_TICK_VERIFY      (15) /* Tick advanced zero hashes, detected at tick verification: PoH params were unknown when the tick parsed. */
     171           6 : #define FD_SCHED_DEAD_REASON_WRONG_HASHES_PER_TICK      (16) /* Ticks did not advance the expected hashes per tick. */
     172           0 : #define FD_SCHED_DEAD_REASON_INTERTICK_HASHES_OVERFLOW  (17) /* More hashes since the last tick than hashes per tick allows. */
     173           6 : #define FD_SCHED_DEAD_REASON_TOO_FEW_TICKS              (18) /* Fewer ticks than required. */
     174           0 : #define FD_SCHED_DEAD_REASON_TICK_HASH_MISMATCH         (19) /* Proof-of-history hash of a tick did not verify. */
     175           0 : #define FD_SCHED_DEAD_REASON_ENTRY_HASH_MISMATCH        (20) /* Proof-of-history hash of a transaction entry did not verify, detected when the entry's PoH hashing task completed. */
     176           0 : #define FD_SCHED_DEAD_REASON_ENTRY_HASH_MISMATCH_INGEST (21) /* Proof-of-history hash of a transaction entry did not verify, detected at FEC ingest when a later FEC set completed the entry's transactions. */
     177           0 : #define FD_SCHED_DEAD_REASON_DEAD_ANCESTOR              (22) /* The block went down with its lineage.  Whether the lineage was discarded or ruled invalid is distinguished by fd_sched_block_is_abandoned. */
     178             : 
     179             : struct fd_sched_mark_dead {
     180             :   ulong     bank_idx;
     181             : };
     182             : typedef struct fd_sched_mark_dead fd_sched_mark_dead_t;
     183             : 
     184             : struct fd_sched_task {
     185             :   ulong task_type; /* Set to one of the task types defined above. */
     186             :   union {
     187             :     fd_sched_block_start_t   block_start[ 1 ];
     188             :     fd_sched_block_end_t     block_end[ 1 ];
     189             :     fd_sched_txn_exec_t      txn_exec[ 1 ];
     190             :     fd_sched_txn_sigverify_t txn_sigverify[ 1 ];
     191             :     fd_sched_poh_hash_t      poh_hash[ 1 ];
     192             :     fd_sched_mark_dead_t     mark_dead[ 1 ];
     193             :   };
     194             : };
     195             : typedef struct fd_sched_task fd_sched_task_t;
     196             : 
     197             : struct __attribute__((packed)) fd_microblock_hdr {
     198             :   /* Number of PoH hashes between this and last microblock */
     199             :   /* 0x00 */ ulong hash_cnt;
     200             : 
     201             :   /* PoH state after evaluating this microblock (including all
     202             :      appends and mixin). The input to the poh calculation of the first
     203             :      microblock is the last hash of the parent block, otherwise it is the
     204             :      hash of the previous microblock. */
     205             :   /* 0x08 */ uchar hash[32];
     206             : 
     207             :   /* Number of transactions in this microblock */
     208             :   /* 0x28 */ ulong txn_cnt;
     209             : };
     210             : typedef struct fd_microblock_hdr fd_microblock_hdr_t;
     211             : 
     212             : FD_PROTOTYPES_BEGIN
     213             : 
     214             : /* fd_sched_{align,footprint} return the required alignment and
     215             :    footprint in bytes for a region of memory to be used as a scheduler.
     216             :    footprint silently returns 0 if params are invalid (thus convenient
     217             :    to validate params).
     218             : 
     219             :    depth controls the reorder buffer transaction count (~1 million
     220             :    recommended for live replay, ~10k recommended for async replay).
     221             :    block_cnt_max is the maximum number of blocks that will be tracked by
     222             :    the scheduler. */
     223             : 
     224             : ulong
     225             : fd_sched_align( void );
     226             : 
     227             : ulong
     228             : fd_sched_footprint( ulong depth,           /* in [FD_SCHED_MIN_DEPTH,FD_SCHED_MAX_DEPTH] */
     229             :                     ulong block_cnt_max ); /* >= 1 */
     230             : 
     231             : /* fd_sched_new creates a sched object backed by the given memory region
     232             :    (conforming to align() and footprint()).  Returns NULL if any
     233             :    parameter is invalid. */
     234             : 
     235             : void *
     236             : fd_sched_new( void *     mem,
     237             :               fd_rng_t * rng,
     238             :               ulong      depth,
     239             :               ulong      block_cnt_max,
     240             :               ulong      exec_cnt );
     241             : 
     242             : fd_sched_t *
     243             : fd_sched_join( void * mem );
     244             : 
     245             : /* Add the data in the FEC set to the scheduler.  If is_last_fec is 1,
     246             :    then this is the last FEC set in the block.  Transactions may span
     247             :    FEC set boundaries.  The scheduler is responsible for incrementally
     248             :    parsing transactions from concatenated FEC set data.  Assumes that
     249             :    FEC sets are delivered in replay order.  That is, forks form a
     250             :    partial ordering over FEC sets: in-order per fork, but arbitrary
     251             :    ordering across forks.  The fork tree is implied by the stream of
     252             :    parent-child relationships delivered in FEC sets.  Also assumes that
     253             :    there is enough space in the scheduler to ingest the FEC set.  The
     254             :    caller should generally call fd_sched_fec_can_ingest() first.
     255             : 
     256             :    Returns 1 on success, 0 if the block is bad and should be marked
     257             :    dead. */
     258             : FD_WARN_UNUSED int
     259             : fd_sched_fec_ingest( fd_sched_t * sched, fd_sched_fec_t * fec );
     260             : 
     261             : /* Check if there is enough space in the scheduler to ingest the data in
     262             :    the FEC set.  Returns 1 if there is, 0 otherwise.  This is a cheap
     263             :    and conservative check. */
     264             : int
     265             : fd_sched_fec_can_ingest( fd_sched_t * sched, fd_sched_fec_t * fec );
     266             : 
     267             : /* Returns the number of worst-case FEC sets sched can ingest. This is a
     268             :    cheap and conservative check. */
     269             : ulong
     270             : fd_sched_can_ingest_cnt( fd_sched_t * sched );
     271             : 
     272             : /* Returns 1 if sched is drained, 0 otherwise.  A drained scheduler will
     273             :    not return more work.  Otherwise, next_ready will return more work,
     274             :    so long as there are exec tiles available. */
     275             : int
     276             : fd_sched_is_drained( fd_sched_t * sched );
     277             : 
     278             : /* Obtain a transaction eligible for execution.  This implies that all
     279             :    prior transactions with w-r or w-w conflicts have completed.
     280             :    Information regarding the scheduled transaction is written to the out
     281             :    pointer.  Returns 1 on success, 0 on failure.  Failures are generally
     282             :    transient and non-fatal, and are simply an indication that no
     283             :    transaction is ready for execution yet.  When in-flight transactions
     284             :    retire or when more FEC sets are ingested, more transactions may
     285             :    become ready for execution.
     286             : 
     287             :    Transactions on the same fork will be returned in a way that
     288             :    maintains the serial fiction.  That is, reordering can happen, but
     289             :    only within the constraint that transactions appear to be ready in
     290             :    the order in which they occur in the block.  Transactions from
     291             :    different forks may interleave, and the caller should be prepared to
     292             :    switch execution context in response to interleavings.  The scheduler
     293             :    will barrier on block boundaries, in the sense that transactions from
     294             :    a subsequent block will not be returned for execution until all
     295             :    transactions from the previous block have completed.  This gives the
     296             :    caller a chance to perform end-of-block processing before
     297             :    transactions from a subsequent block start executing.  In general,
     298             :    the caller should check if the last transaction in the current block
     299             :    is done, and if so, do end-of-block processing before calling this
     300             :    function to start the next block.
     301             : 
     302             :    In addition to returning transactions for execution, this function
     303             :    may also return a sigverify task.  Sigverify can be completed
     304             :    asynchronously outside the critical path of transaction execution, as
     305             :    long as every transaction in a block passes sigverify before we
     306             :    commit the block.  The scheduler prioritizes actual execution of
     307             :    transactions over sigverify, and in general sigverify tasks are only
     308             :    returned when no real transaction can be dispatched.  In other words,
     309             :    the scheduler tries to exploit idle cycles in the exec tiles during
     310             :    times of low parallelism critical path progression.
     311             : 
     312             :    This function may also return a PoH hashing task.  These tasks are
     313             :    lower priority than transaction execution, but higher priority than
     314             :    sigverify.  This is because sigverify tasks are generally bite-sized,
     315             :    whereas PoH hashing can be longer, so we would like to get started on
     316             :    hashing sooner rather than later. */
     317             : ulong
     318             : fd_sched_task_next_ready( fd_sched_t * sched, fd_sched_task_t * out );
     319             : 
     320             : /* Mark a task as complete.  For transaction execution, this means that
     321             :    the effects of the execution are now visible on any core that could
     322             :    execute a subsequent transaction.  Returns FD_SCHED_DEAD_REASON_NONE
     323             :    (0) on success.  If, given the result of the task, the block turns
     324             :    out to be bad, returns the nonzero FD_SCHED_DEAD_REASON_* it was
     325             :    ruled bad for.  Only PoH tasks can rule a block bad, and not only
     326             :    for a PoH hash mismatch: eager tick verification also runs on this
     327             :    path.
     328             : 
     329             :    If a block has been abandoned or marked dead for any reason, it'll be
     330             :    pruned the moment in-flight task count hits 0 due to the last task
     331             :    completing.  Then, in the immediate ensuing stem run loop,
     332             :    sched_pruned_next() will return the index for the corresponding bank
     333             :    so the refcnt can be decremented for sched.
     334             : 
     335             :    The transaction at the given index may be freed upon return from this
     336             :    function.  Nonetheless, as long as there is no intervening FEC
     337             :    ingestion, it would still be safe to query the transaction using
     338             :    get_txn(). */
     339             : int
     340             : fd_sched_task_done( fd_sched_t * sched, ulong task_type, ulong txn_idx, ulong exec_idx, void * data );
     341             : 
     342             : /* Abandon a block.  This means that we are no longer interested in
     343             :    executing the block.  This also implies that any block which chains
     344             :    off of the provided block shall be abandoned.  This is mainly used
     345             :    when a block is aborted because we decided that it would be a
     346             :    dead/invalid block, and so there's no point in spending resources
     347             :    executing it.  The scheduler will no longer return transactions from
     348             :    abandoned blocks for execution.  This should only be invoked on an
     349             :    actively replayed block, and should only be invoked once on it.
     350             : 
     351             :    For the purposes of bank lifetime management, sched is a subsidiary
     352             :    of banks.  So while sched sets things in motion for a bad block to be
     353             :    eagerly pruned, banks/replay is the sole initiator of actual pruning.
     354             :    The way this works is that an abandoned block will have its refcnt
     355             :    queued for release by sched as soon as, and only if, the block has no
     356             :    more in-flight tasks associated with it.  No sooner, no later.  In
     357             :    the immediate ensuing stem run loop, sched_pruned_next() will return
     358             :    the index for the corresponding bank so the refcnt can be decremented
     359             :    for sched.  After that point, banks will eventually instruct sched to
     360             :    prune the block, when all other components release their refcnts on
     361             :    said bank.  Then the bank_idx may be recycled for another block.
     362             : 
     363             :    invalid is 1 if the replay tile ruled the block invalid (sigverify
     364             :    or runtime failure — checks the scheduler does not run itself):
     365             :    descendants inherit the dead-lineage flavor (DEAD_ANCESTOR); the
     366             :    scheduler records no reason of its own, the replay tile owns the
     367             :    specific one.  invalid is 0 if the block is merely discarded
     368             :    (eviction): the lineage is flagged abandoned instead. */
     369             : void
     370             : fd_sched_block_abandon( fd_sched_t * sched, ulong bank_idx, int invalid );
     371             : 
     372             : /* fd_sched_get_dead_reason returns the scheduler's reason (one of
     373             :    FD_SCHED_DEAD_REASON_*) for why the block at bank_idx went down.
     374             :    Returns FD_SCHED_DEAD_REASON_NONE if the block itself was merely
     375             :    discarded (root advance, eviction) or if no block is currently
     376             :    tracked at bank_idx.  Descendants of a discarded lineage carry
     377             :    DEAD_ANCESTOR like any other lineage death;
     378             :    fd_sched_block_is_abandoned disambiguates discarded from
     379             :    ruled-invalid.  The recorded reason is the first one; later failures
     380             :    on an already-dead block (e.g. an in-flight PoH task draining after
     381             :    the block was abandoned) do not overwrite it. */
     382             : int
     383             : fd_sched_get_dead_reason( fd_sched_t * sched, ulong bank_idx );
     384             : 
     385             : /* fd_sched_block_is_abandoned returns 1 if the block went down with a
     386             :    discarded (not invalid) lineage, 0 otherwise (including when no
     387             :    block is tracked at bank_idx). */
     388             : int
     389             : fd_sched_block_is_abandoned( fd_sched_t * sched, ulong bank_idx );
     390             : 
     391             : /* Prune the given block including descendants of it. */
     392             : void
     393             : fd_sched_cancel( fd_sched_t * sched, ulong bank_idx );
     394             : 
     395             : /* Add a block as immediately done to the scheduler.  This is useful for
     396             :    installing the snapshot slot, or for informing the scheduler of a
     397             :    packed leader block.  Parent block should be ULONG_MAX for the
     398             :    snapshot slot, and otherwise a block that hasn't been pruned. */
     399             : void
     400             : fd_sched_block_add_done( fd_sched_t * sched, ulong bank_idx, ulong parent_bank_idx, ulong slot );
     401             : 
     402             : /* Advance the root, pruning all blocks across forks that do not descend
     403             :    from the new root.  Assumes the new root is in the fork tree and
     404             :    connected to the current root.  Also assumes that there are no more
     405             :    in-flight transactions from the soon-to-be-pruned blocks.  This
     406             :    should be called after root_notify() and the caller is responsible
     407             :    for figuring out the new root to safely prune to. */
     408             : void
     409             : fd_sched_advance_root( fd_sched_t * sched, ulong root_idx );
     410             : 
     411             : /* Notify the scheduler of a new root.  This has the effect of calling
     412             :    abandon() on all minority forks that do not descend from the new
     413             :    root.  Shortly after a call to this function, in-flight transactions
     414             :    from these abandoned blocks should retire from the execution
     415             :    pipeline, and the new root will be safe for pruning. */
     416             : void
     417             : fd_sched_root_notify( fd_sched_t * sched, ulong root_idx );
     418             : 
     419             : /* Returns the index of a bank whose refcnt should be decremented for
     420             :    sched.  This function should be called in a loop to drain all
     421             :    outstanding refcnt decrements before any other sched API is called in
     422             :    a stem run loop.  Returns ULONG_MAX when there are no more
     423             :    outstanding references from sched and the loop should break. */
     424             : ulong
     425             : fd_sched_pruned_block_next( fd_sched_t * sched );
     426             : 
     427             : void
     428             : fd_sched_set_poh_params( fd_sched_t * sched, ulong bank_idx, ulong tick_height, ulong max_tick_height, ulong hashes_per_tick, fd_hash_t const * start_poh );
     429             : 
     430             : /* fd_sched_block_verify_ticks sets the tick window and verifies
     431             :    ticks on bank_idx (shred fuzz harness, no exec).  Returns
     432             :    FD_SCHED_DEAD_REASON_NONE (0) if valid, else the
     433             :    FD_SCHED_DEAD_REASON_* the ticks are invalid for.  Does not rule the
     434             :    block invalid; the caller decides what to do with the verdict. */
     435             : int
     436             : fd_sched_block_verify_ticks( fd_sched_t * sched,
     437             :                              ulong        bank_idx,
     438             :                              ulong        tick_height,
     439             :                              ulong        max_tick_height,
     440             :                              ulong        hashes_per_tick );
     441             : 
     442             : /* fd_sched_set_bypass_poh_verify configures whether the per-microblock
     443             :    PoH end_hash comparison in maybe_mixin is bypassed.  This is intended
     444             :    for test and fuzz harnesses: the expected end_hash is carried in the
     445             :    shred payload, so comparing it would reject any mutated input before
     446             :    the deeper parse/tick logic is exercised.  Production call sites
     447             :    should leave this disabled. */
     448             : void
     449             : fd_sched_set_bypass_poh_verify( fd_sched_t * sched, int bypass_poh_verify );
     450             : 
     451             : /* fd_sched_set_bypass_alut_resolution bypasses ALUT resolution during
     452             :    parsing (test/fuzz: no accounts DB).  ALUT txns become serializing.
     453             :    Production call sites should leave this disabled. */
     454             : void
     455             : fd_sched_set_bypass_alut_resolution( fd_sched_t * sched, int bypass_alut_resolution );
     456             : 
     457             : fd_txn_p_t *
     458             : fd_sched_get_txn( fd_sched_t * sched, ulong txn_idx );
     459             : 
     460             : fd_sched_txn_info_t *
     461             : fd_sched_get_txn_info( fd_sched_t * sched, ulong txn_idx );
     462             : 
     463             : fd_hash_t *
     464             : fd_sched_get_poh( fd_sched_t * sched, ulong bank_idx );
     465             : 
     466             : uint
     467             : fd_sched_get_shred_cnt( fd_sched_t * sched, ulong bank_idx );
     468             : 
     469             : void
     470             : fd_sched_metrics_write( fd_sched_t * sched );
     471             : 
     472             : /* Serialize the current state as a cstr to the returned buffer.  Caller
     473             :    may read from the buffer until the next invocation of any fd_sched
     474             :    function. */
     475             : char *
     476             : fd_sched_get_state_cstr( fd_sched_t * sched );
     477             : 
     478             : void *
     479             : fd_sched_leave( fd_sched_t * sched );
     480             : 
     481             : void *
     482             : fd_sched_delete( void * mem );
     483             : 
     484             : FD_PROTOTYPES_END
     485             : 
     486             : #endif /* HEADER_fd_src_discof_replay_fd_sched_h */

Generated by: LCOV version 1.14