Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_leaders_fd_leaders_base_h 2 : #define HEADER_fd_src_flamenco_leaders_fd_leaders_base_h 3 : 4 : #include "../types/fd_types_custom.h" 5 : #include "../features/fd_features.h" 6 : 7 0 : #define MAX_SLOTS_PER_EPOCH 432000UL 8 : #define MAX_PUB_CNT 50000UL 9 242211 : #define MAX_STAKED_LEADERS 40200UL 10 : 11 : /* Follows message structure in fd_stake_ci_stake_msg_init. 12 : Frankendancer only */ 13 : struct fd_stake_weight_msg_t { 14 : ulong epoch; /* Epoch for which the stake weights are valid */ 15 : ulong staked_cnt; /* Number of staked nodes */ 16 : ulong start_slot; /* Start slot of the epoch */ 17 : ulong slot_cnt; /* Number of slots in the epoch */ 18 : ulong excluded_stake; /* Total stake that is excluded from leader selection */ 19 : ulong vote_keyed_lsched; /* 1=use vote-keyed leader schedule, 0=use old leader schedule */ 20 : fd_vote_stake_weight_t weights[]; /* Stake weights for each staked node */ 21 : }; 22 : typedef struct fd_stake_weight_msg_t fd_stake_weight_msg_t; 23 : 24 0 : #define FD_STAKE_CI_STAKE_MSG_HEADER_SZ (sizeof(fd_stake_weight_msg_t)) 25 0 : #define FD_STAKE_CI_STAKE_MSG_RECORD_SZ (sizeof(fd_vote_stake_weight_t)) 26 0 : #define FD_STAKE_CI_STAKE_MSG_SZ (FD_STAKE_CI_STAKE_MSG_HEADER_SZ + MAX_STAKED_LEADERS * FD_STAKE_CI_STAKE_MSG_RECORD_SZ) 27 : 28 0 : #define FD_STAKE_OUT_MTU FD_STAKE_CI_STAKE_MSG_SZ 29 : 30 0 : static inline ulong fd_stake_weight_msg_sz( ulong cnt ) { 31 0 : return FD_STAKE_CI_STAKE_MSG_HEADER_SZ + cnt * FD_STAKE_CI_STAKE_MSG_RECORD_SZ; 32 0 : } 33 : 34 : /* Firedancer only */ 35 : struct fd_epoch_info_msg_t { 36 : ulong epoch; /* Epoch for which the info is valid */ 37 : ulong staked_cnt; /* Number of staked nodes */ 38 : ulong start_slot; /* Start slot of the epoch */ 39 : ulong slot_cnt; /* Number of slots in the epoch */ 40 : ulong excluded_stake; /* Total stake that is excluded from leader selection */ 41 : ulong vote_keyed_lsched; /* Whether vote account keyed leader schedule is active */ 42 : fd_epoch_schedule_t epoch_schedule; /* Epoch schedule */ 43 : fd_features_t features; /* Feature activation slots */ 44 : fd_vote_stake_weight_t weights[]; /* Flexible array member (must be last) */ 45 : }; 46 : typedef struct fd_epoch_info_msg_t fd_epoch_info_msg_t; 47 : 48 0 : #define FD_EPOCH_INFO_MSG_HEADER_SZ (sizeof(fd_epoch_info_msg_t)) 49 0 : #define FD_EPOCH_INFO_MAX_MSG_SZ (FD_EPOCH_INFO_MSG_HEADER_SZ + MAX_STAKED_LEADERS * sizeof(fd_vote_stake_weight_t)) 50 0 : #define FD_EPOCH_OUT_MTU FD_EPOCH_INFO_MAX_MSG_SZ 51 : 52 0 : static inline ulong fd_epoch_info_msg_sz( ulong cnt ) { 53 0 : return FD_EPOCH_INFO_MSG_HEADER_SZ + ( cnt * sizeof(fd_vote_stake_weight_t) ); 54 0 : } 55 : 56 : #endif /* HEADER_fd_src_flamenco_leaders_fd_leaders_base_h */