Line data Source code
1 : /* THIS FILE WAS GENERATED BY gen_events.py. DO NOT EDIT BY HAND! */ 2 : #ifndef HEADER_fd_src_disco_events_generated_fd_event_gen_h 3 : #define HEADER_fd_src_disco_events_generated_fd_event_gen_h 4 : 5 : #include "../fd_circq.h" 6 : #include "../fd_event_client.h" 7 : #include "../fd_event_report.h" 8 : 9 : /* Slot that was voted on */ 10 : struct fd_event_signed_vote_tower { 11 : ulong slot; /* Slot being voted on / locked out for */ 12 : uchar confirmation_count; /* Confirmation count (higher = closer to root) */ 13 : }; 14 : typedef struct fd_event_signed_vote_tower fd_event_signed_vote_tower_t; 15 : 16 : /* The validator generated a vote transaction */ 17 : struct fd_event_signed_vote { 18 : uchar signed_txn[ 1232UL ]; /* Serialized signed vote transaction */ 19 : ulong signed_txn_len; /* Length of signed_txn (<= 1232) */ 20 : uchar vote_account[ 32UL ]; /* The public key of the vote account */ 21 : uchar vote_authority[ 32UL ]; /* The public key that authorized the vote */ 22 : uchar fee_payer[ 32UL ]; /* The public key that pays for transaction fees */ 23 : uchar signature[ 64UL ]; /* Signature identifying the transaction */ 24 : ulong vote_slot; /* Slot being voted on (top of tower) */ 25 : uchar vote_bank_hash[ 32UL ]; /* Bank hash of the slot being voted on */ 26 : uchar vote_block_id[ 32UL ]; /* Block ID of the slot being voted on */ 27 : uchar txn_blockhash[ 32UL ]; /* Recent blockhash parameter of the vote transaction */ 28 : fd_event_signed_vote_tower_t tower[ 31UL ]; /* Tower of slots being voted on (oldest to newest) */ 29 : ulong tower_cnt; /* Number of tower entries (<= 31) */ 30 : }; 31 : typedef struct fd_event_signed_vote fd_event_signed_vote_t; 32 : 33 : /* Worst-case encoded size of a signed_vote event (envelope + Event 34 : submsg + inner submsg + all fields, padded for encoder slack). */ 35 0 : #define FD_EVENT_SIGNED_VOTE_BUF_MAX (2765UL) 36 : 37 : /* The commitment level reached, from weakest to strongest: processed, propagated, duplicate, optimistic, super, rooted. ignored is a separate terminal outcome rather than a strengthening level. */ 38 0 : #define FD_EVENT_SLOT_CONFIRMED_LEVEL_IGNORED (1) /* Replay finished a block that consensus had already pruned, so it never reached any commitment level. */ 39 0 : #define FD_EVENT_SLOT_CONFIRMED_LEVEL_PROCESSED (2) /* Replayed locally on the majority fork, with no cluster stake required. Equivalent to Solana's 'processed' commitment. */ 40 0 : #define FD_EVENT_SLOT_CONFIRMED_LEVEL_PROPAGATED (3) /* More than a third of stake has observed the block, confirming it has propagated. */ 41 0 : #define FD_EVENT_SLOT_CONFIRMED_LEVEL_DUPLICATE (4) /* At least 52% of stake voted for this exact block, guaranteeing the cluster converges on it even when a slot equivocates. */ 42 0 : #define FD_EVENT_SLOT_CONFIRMED_LEVEL_OPTIMISTIC (5) /* More than two thirds of stake voted for the block. Equivalent to Solana's 'confirmed' commitment. */ 43 0 : #define FD_EVENT_SLOT_CONFIRMED_LEVEL_SUPER (6) /* More than four fifths of stake voted for the block. Used when waiting for a supermajority at boot. */ 44 0 : #define FD_EVENT_SLOT_CONFIRMED_LEVEL_ROOTED (7) /* The block or a descendant reached maximum lockout and can never be rolled back. The strongest level, equivalent to Solana's 'finalized' commitment. */ 45 : 46 : /* A slot reached a commitment level. Emitted once per slot per level reached. Join to block_completed on bank_seq, or on slot and block_id. */ 47 : struct fd_event_slot_confirmed { 48 : ulong bank_seq; /* Monotonic sequence number identifying this block within the current run; the join key to block_completed. Restarts at 1 each time a snapshot is loaded, so pair it with the stream's boot id. 0 means unavailable, which happens for forward confirmations where the block has not been replayed. */ 49 : ulong slot; /* The slot being confirmed. */ 50 : uchar block_id[ 32UL ]; /* Unique identifier of the block being confirmed; the join key to block_completed. */ 51 : ulong stake; /* Stake in lamports supporting this confirmation. Divide by total_stake for the ratio that crossed the level's threshold. 0 means unavailable. */ 52 : ulong total_stake; /* Total cluster stake in lamports at confirmation time; the denominator for the confirmation ratio. 0 means unavailable. */ 53 : int valid; /* Whether this block is eligible for fork choice. An equivocating block becomes eligible again only once duplicate confirmed. */ 54 : int level; /* The commitment level reached, from weakest to strongest: processed, propagated, duplicate, optimistic, super, rooted. ignored is a separate terminal outcome rather than a strengthening level. */ 55 : int forward; /* True when the block was confirmed by votes seen over gossip before it was replayed locally. Always false for processed and rooted, which require a local replay. */ 56 : }; 57 : typedef struct fd_event_slot_confirmed fd_event_slot_confirmed_t; 58 : 59 : /* Worst-case encoded size of a slot_confirmed event (envelope + Event 60 : submsg + inner submsg + all fields, padded for encoder slack). */ 61 0 : #define FD_EVENT_SLOT_CONFIRMED_BUF_MAX (221UL) 62 : 63 : /* Largest generated event struct; a consumer can stage any incoming 64 : event in a buffer of this size. */ 65 : #define FD_EVENT_GEN_STRUCT_MAX (( sizeof(fd_event_slot_confirmed_t) > sizeof(fd_event_signed_vote_t) ? sizeof(fd_event_slot_confirmed_t) : sizeof(fd_event_signed_vote_t) )) 66 : 67 : FD_PROTOTYPES_BEGIN 68 : 69 : /* Serialize a signed_vote event into the circq, reserving an event id 70 : from the client and writing the standard event envelope. Mirrors 71 : the hand-written fd_pb_* path. */ 72 : void 73 : fd_event_signed_vote_serialize( fd_circq_t * circq, 74 : fd_event_client_t * client, 75 : long timestamp_nanos, 76 : ulong link_seq, 77 : fd_event_signed_vote_t const * msg ); 78 : 79 : /* Serialize a slot_confirmed event into the circq, reserving an event id 80 : from the client and writing the standard event envelope. Mirrors 81 : the hand-written fd_pb_* path. */ 82 : void 83 : fd_event_slot_confirmed_serialize( fd_circq_t * circq, 84 : fd_event_client_t * client, 85 : long timestamp_nanos, 86 : ulong link_seq, 87 : fd_event_slot_confirmed_t const * msg ); 88 : 89 : /* Serialize an event of the given type id (the schema id carried in the 90 : report frag's sig) from a fully-formed fd_event_<name>_t at ev. */ 91 : void 92 : fd_event_serialize_by_type( ulong type, 93 : fd_circq_t * circq, 94 : fd_event_client_t * client, 95 : long timestamp_nanos, 96 : ulong link_seq, 97 : void const * ev, 98 : ulong ev_sz ); 99 : 100 : /* Report a signed_vote event (SignedVote, id 3) to the event tile via 101 : the thread-local reporter (no-op when the tile has no event link). */ 102 : static inline void 103 0 : fd_event_report_signed_vote( fd_event_signed_vote_t const * msg ) { 104 0 : fd_event_report_( 3UL, msg, sizeof(fd_event_signed_vote_t) ); 105 0 : } 106 : 107 : /* Report a slot_confirmed event (SlotConfirmed, id 4) to the event tile via 108 : the thread-local reporter (no-op when the tile has no event link). */ 109 : static inline void 110 0 : fd_event_report_slot_confirmed( fd_event_slot_confirmed_t const * msg ) { 111 0 : fd_event_report_( 4UL, msg, sizeof(fd_event_slot_confirmed_t) ); 112 0 : } 113 : 114 : FD_PROTOTYPES_END 115 : 116 : #endif