Line data Source code
1 : #ifndef HEADER_fd_src_discof_votor_fd_votor_tile_h 2 : #define HEADER_fd_src_discof_votor_fd_votor_tile_h 3 : 4 : #include "../../ballet/bls/fd_bls.h" 5 : #include "../../disco/topo/fd_topo.h" 6 : #include "../../waltz/quic/tls/fd_quic_tls.h" 7 : 8 0 : #define FD_VOTOR_SIG_CERTED (0) 9 0 : #define FD_VOTOR_SIG_REPAIR (1) 10 0 : #define FD_VOTOR_SIG_LEADER (2) 11 0 : #define FD_VOTOR_SIG_REWARD (3) 12 0 : #define FD_VOTOR_SIG_QUORUM (4) 13 0 : #define FD_VOTOR_SIG_PARENT_READY (5) 14 : 15 0 : #define FD_VOTOR_NET_BURST (2UL*(1UL+FD_QUIC_TLS_HS_DATA_CNT+3UL)) /* 1 ACK + 1 TLS + 3 1-RTT pkts * 2 for both client and server. EXCLUDES DATAGRAMS. */ 16 : 17 : /* QUIC_DGRAM_BURST bounds the number of QUIC DATAGRAME frames that can 18 : fit in a single net packet. This can result in a burst of up to 9 19 : quic_server_datagram_rx calls in a single tile loop. 20 : 21 : 2048 B FD_NET_MTU 22 : - 14 B Ethernet header 23 : - 20 B IPv4 header 24 : - 8 B UDP header 25 : - 1 B short header flags 26 : - 8 B destination conn id, FD_QUIC_CONN_ID_SZ 27 : - 1 B packet number, at least 28 : - 16 B AEAD tag 29 : = 1980 B DATAGRAM frames 30 : / 207 B smallest frame: 1 B type, 2 B length, 204 B skip or final vote (a cert is at least 212 B) 31 : = 9 (9.57, and with a last frame of 205 B without its length, 8*207+205 = 1861 B still fits only 9) */ 32 : 33 0 : #define QUIC_DGRAM_BURST (9UL) 34 : 35 0 : #define FD_VOTOR_OUT_BURST (1UL+AG_SLOTS_PER_WINDOW+1UL+QUIC_DGRAM_BURST+1UL) /* 1 leader + 4 reward + 1 republished reward, then 2 certed or 1 quorum + 1 repair, or a catchup repair per datagram, + 1 parent ready */ 36 : 37 : /* fd_votor_certed notifies that we have a valid cert for the block 38 : reaching a given state. A final cert names only its slot, so it is 39 : reported once the notarization of that slot has formed too. 40 : 41 : kind | block_id | agg | agg2 42 : ---------------|----------|-------------|--------------------- 43 : final | ✓ | final votes | notar votes 44 : fast_final | ✓ | notar votes | - 45 : notar | ✓ | notar votes | - 46 : notar_fallback | ✓ | notar votes | notar-fallback votes 47 : skip | ✗ | skip votes | skip-fallback votes */ 48 : 49 : struct fd_votor_certed { 50 : uint kind; /* AG_CERT_KIND_* */ 51 : ulong slot; 52 : fd_hash_t block_id; 53 : fd_bls_agg_t agg; 54 : fd_bls_agg_t agg2; 55 : }; 56 : typedef struct fd_votor_certed fd_votor_certed_t; 57 : 58 : /* fd_votor_leader notifies that it is time to become leader for the 59 : window beginning from slot. */ 60 : 61 : struct fd_votor_leader { 62 : ulong slot; 63 : ulong parent_slot; 64 : fd_hash_t parent_block_id; 65 : long parent_ready_ns; 66 : }; 67 : typedef struct fd_votor_leader fd_votor_leader_t; 68 : 69 : /* fd_votor_repair names a block the pool has certs or votes for but 70 : replay has not completed, so rotor fetches it. A slot past the pool 71 : window has a verified cert and a null block_id, so rotor 72 : catches up toward it. */ 73 : 74 : struct fd_votor_repair { 75 : ulong slot; 76 : fd_hash_t block_id; 77 : }; 78 : typedef struct fd_votor_repair fd_votor_repair_t; 79 : 80 : /* fd_votor_reward notifies Votor has produced a new reward cert (agg of 81 : all skip / reward votes). Votor publishes a fd_votor_reward_t for 82 : every slot of a leader window right after the window's 83 : fd_votor_leader_t (replay only reads them at block end, for the 84 : footer), and may publish add'l reward certs that include more votes 85 : later. */ 86 : 87 : struct fd_votor_reward { 88 : ulong slot; 89 : fd_hash_t block_id; 90 : fd_bls_agg_t agg_notar; 91 : fd_bls_agg_t agg_skip; 92 : }; 93 : typedef struct fd_votor_reward fd_votor_reward_t; 94 : 95 : /* fd_votor_quorum notifies that the pool's votes or certs moved a block 96 : to a new state outside of constructing a cert: it became SafeToNotar 97 : (Definition 16), or a descendant finalization implicitly finalized or 98 : skipped. block_id is all 0s for a skipped slot. */ 99 : 100 0 : #define FD_VOTOR_QUORUM_KIND_SAFE_TO_NOTAR (0) 101 0 : #define FD_VOTOR_QUORUM_KIND_IMPLICITLY_SKIPPED (1) 102 0 : #define FD_VOTOR_QUORUM_KIND_IMPLICITLY_FINALIZED (2) 103 : 104 : struct fd_votor_quorum { 105 : uint kind; /* FD_VOTOR_QUORUM_KIND_* */ 106 : ulong slot; 107 : fd_hash_t block_id; 108 : }; 109 : typedef struct fd_votor_quorum fd_votor_quorum_t; 110 : 111 : /* fd_votor_parent_ready notifies that slot, a window start, is the 112 : highest certs have made ParentReady, so earlier windows are skipped. */ 113 : 114 : struct fd_votor_parent_ready { 115 : ulong slot; 116 : }; 117 : typedef struct fd_votor_parent_ready fd_votor_parent_ready_t; 118 : 119 : union fd_votor_msg { 120 : fd_votor_certed_t certed; 121 : fd_votor_repair_t repair; 122 : fd_votor_leader_t leader; 123 : fd_votor_reward_t reward; 124 : fd_votor_quorum_t quorum; 125 : fd_votor_parent_ready_t parent_ready; 126 : }; 127 : typedef union fd_votor_msg fd_votor_msg_t; 128 : 129 : extern fd_topo_run_tile_t fd_tile_votor; 130 : 131 : #endif /* HEADER_fd_src_discof_votor_fd_votor_tile_h */