LCOV - code coverage report
Current view: top level - choreo - fd_choreo_base.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 1 6 16.7 %
Date: 2025-09-17 04:38:03 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_choreo_fd_choreo_base_h
       2             : #define HEADER_fd_src_choreo_fd_choreo_base_h
       3             : 
       4             : /* Choreo consensus library:
       5             : 
       6             :   - eqvoc: Block and vote equivocation.
       7             : 
       8             :   - forks: Frontier of banks.
       9             : 
      10             :   - ghost: Fork choice rule.
      11             : 
      12             :   - tower: TowerBFT algorithm.
      13             : 
      14             :   - voter: Voter tracking.
      15             : 
      16             :   */
      17             : 
      18             : #include "../flamenco/fd_flamenco.h"
      19             : #include "../flamenco/types/fd_types.h"
      20             : 
      21             : /* clang-format off */
      22           0 : #define FD_BLOCK_MAX                  (1UL << 14UL) /* the maximum # of blocks we support holding at once. must be >=512. */
      23             : #define FD_VOTER_MAX                  (1UL << 12UL) /* the maximum # of unique voters ie. node pubkeys. */
      24          48 : #define FD_EQVOCSAFE_PCT              (0.52)
      25             : #define FD_CONFIRMED_PCT              (2.0 / 3.0)
      26             : #define FD_FINALIZED_PCT              FD_CONFIRMED_PCT
      27             : #define FD_SLOT_HASH_CMP(k0,k1)       (fd_int_if(((k0)->slot)<((k1)->slot),-1,fd_int_if(((k0)->slot)>((k1)->slot),1),memcmp((k0),(k1),sizeof(fd_slot_hash_t))))
      28           0 : #define FD_SLOT_HASH_EQ(k0,k1)        ((((k0)->slot)==((k1)->slot)) & !(memcmp(((k0)->hash.uc),((k1)->hash.uc),sizeof(fd_hash_t))))
      29           0 : #define FD_SLOT_HASH_HASH(key,seed)   fd_ulong_hash( ((key)->slot) ^ ((key)->hash.ul[0]) ^ (seed) )
      30             : #define FD_SLOT_PUBKEY_CMP(a,b)       FD_SLOT_HASH_CMP(a,b)
      31           0 : #define FD_SLOT_PUBKEY_EQ(k0,k1)      FD_SLOT_HASH_EQ(k0,k1)
      32           0 : #define FD_SLOT_PUBKEY_HASH(key,seed) FD_SLOT_HASH_HASH(key,seed)
      33             : /* clang-format on */
      34             : 
      35             : /* The block_id is the merkle root of the last FEC set for a slot.  This
      36             :    is guaranteed to be unique (practically speaking, the probability of
      37             :    collision before sun burns out is negligibly miniscule).
      38             : 
      39             :    This is used as the identifier for a block (hence "block_id") because
      40             :    unlike the slot number, if a leader equivocates (ie. produces
      41             :    multiple blocks for the same slot), the block_id will remain unique
      42             :    unlike the slot. */
      43             : 
      44             : typedef uchar fd_block_id_t[ 32UL ];
      45             : 
      46             : typedef fd_slot_hash_t fd_slot_pubkey_t;
      47             : 
      48             : #endif /* HEADER_fd_src_choreo_fd_choreo_base_h */

Generated by: LCOV version 1.14