Line data Source code
1 : #ifndef HEADER_fd_src_flamenco_alpenglow_fd_block_marker_h 2 : #define HEADER_fd_src_flamenco_alpenglow_fd_block_marker_h 3 : 4 : #include "../fd_flamenco_base.h" 5 : #include "../../ballet/bls/fd_bls.h" 6 : #include "../../choreo/votor/ag_votor_base.h" 7 : 8 288 : #define FD_BLOCK_MARKER_KIND_FOOTER (0U) 9 276 : #define FD_BLOCK_MARKER_KIND_HEADER (1U) 10 27 : #define FD_BLOCK_MARKER_KIND_UPDATE_PARENT (2U) 11 6 : #define FD_BLOCK_MARKER_KIND_GENESIS_CERT (3U) 12 : 13 21 : #define FD_BLOCK_FOOTER_USER_AGENT_MAX (255UL) 14 : 15 : /* FD_NUM_SLOTS_FOR_REWARD is how far back the reward certs in a block 16 : footer reach: a leader producing slot s attests the voters of 17 : s-FD_NUM_SLOTS_FOR_REWARD. */ 18 : 19 0 : #define FD_NUM_SLOTS_FOR_REWARD AG_REWARD_SLOT_DELTA 20 : 21 : struct fd_block_header { 22 : ulong parent_slot; 23 : fd_hash_t parent_block_id; 24 : }; 25 : typedef struct fd_block_header fd_block_header_t; 26 : 27 : struct fd_update_parent { 28 : ulong new_parent_slot; 29 : fd_hash_t new_parent_block_id; 30 : }; 31 : typedef struct fd_update_parent fd_update_parent_t; 32 : 33 : struct fd_block_footer_cert { 34 : ulong slot; 35 : fd_hash_t block_id; /* zero when the wire carries none: final and skip reward certs */ 36 : uchar sig[ FD_BLS_SIG_COMPRESSED_SZ ]; /* compressed, unverified */ 37 : ushort nbits; /* signer bitmap bit count, <=AG_VAT_MAX */ 38 : fd_bls_set_t signer_set[ fd_bls_set_word_cnt ]; /* decoded base2 signer bitmap */ 39 : }; 40 : typedef struct fd_block_footer_cert fd_block_footer_cert_t; 41 : 42 : struct fd_block_footer { 43 : fd_hash_t bank_hash; 44 : ulong block_producer_time_nanos; 45 : ulong user_agent_len; 46 : uchar user_agent[ FD_BLOCK_FOOTER_USER_AGENT_MAX ]; 47 : 48 : int has_fast_final_cert; 49 : int has_final_cert; 50 : fd_block_footer_cert_t fast_final_cert; 51 : fd_block_footer_cert_t final_cert; 52 : fd_block_footer_cert_t notar_cert; 53 : 54 : int has_skip_reward_cert; 55 : fd_block_footer_cert_t skip_reward_cert; 56 : int has_notar_reward_cert; 57 : fd_block_footer_cert_t notar_reward_cert; 58 : }; 59 : typedef struct fd_block_footer fd_block_footer_t; 60 : 61 : struct fd_block_marker { 62 : uint kind; /* FD_BLOCK_MARKER_KIND_* */ 63 : union { 64 : fd_block_header_t header; 65 : fd_block_footer_t footer; 66 : fd_update_parent_t update_parent; 67 : }; 68 : }; 69 : typedef struct fd_block_marker fd_block_marker_t; 70 : 71 : FD_PROTOTYPES_BEGIN 72 : 73 : int 74 : fd_block_footer_cert_from_agg( fd_block_footer_cert_t * cert, 75 : ulong slot, 76 : uchar const * block_hash, 77 : fd_bls_agg_t const * agg ); 78 : 79 : FD_PROTOTYPES_END 80 : 81 : #endif /* HEADER_fd_src_flamenco_alpenglow_fd_block_marker_h */