Line data Source code
1 : #ifndef HEADER_fd_src_discof_replay_fd_replay_tile_h 2 : #define HEADER_fd_src_discof_replay_fd_replay_tile_h 3 : 4 : #include "../poh/fd_poh_tile.h" 5 : #include "../../disco/tiles.h" 6 : #include "../../flamenco/types/fd_types_custom.h" 7 : 8 0 : #define REPLAY_SIG_SLOT_COMPLETED (0) 9 0 : #define REPLAY_SIG_ROOT_ADVANCED (1) 10 0 : #define REPLAY_SIG_VOTE_STATE (2) 11 0 : #define REPLAY_SIG_RESET (3) 12 0 : #define REPLAY_SIG_BECAME_LEADER (4) 13 : 14 : struct fd_replay_slot_completed { 15 : ulong slot; 16 : ulong root_slot; 17 : ulong epoch; 18 : ulong slot_in_epoch; 19 : ulong block_height; 20 : ulong parent_slot; 21 : 22 : fd_hash_t block_id; /* block id (last FEC set's merkle root) of the slot received from replay */ 23 : fd_hash_t parent_block_id; /* parent block id of the slot received from replay */ 24 : fd_hash_t bank_hash; /* bank hash of the slot received from replay */ 25 : fd_hash_t block_hash; /* last microblock header hash of slot received from replay */ 26 : 27 : ulong transaction_count; 28 : 29 : /* Reference to the bank for this completed slot. TODO: We can 30 : eliminate non-timestamp fields and have consumers just use 31 : bank_idx. */ 32 : ulong bank_idx; 33 : ulong parent_bank_idx; /* ULONG_MAX if unavailable */ 34 : 35 : long first_fec_set_received_nanos; /* timestamp when replay received the first fec of the slot from turbine or repair */ 36 : long preparation_begin_nanos; /* timestamp when replay began preparing the state to begin execution of the slot */ 37 : long first_transaction_scheduled_nanos; /* timestamp when replay first sent a transaction to be executed */ 38 : long last_transaction_finished_nanos; /* timestamp when replay received the last execution completion */ 39 : long completion_time_nanos; /* timestamp when replay completed finalizing the slot and notified tower */ 40 : }; 41 : 42 : typedef struct fd_replay_slot_completed fd_replay_slot_completed_t; 43 : 44 : struct fd_replay_root_advanced { 45 : ulong bank_idx; 46 : }; 47 : 48 : typedef struct fd_replay_root_advanced fd_replay_root_advanced_t; 49 : 50 : /* The replay tile currently, on slot replay completion, sends vote 51 : states from the completed bank to the Tower tile so it can determine 52 : how to vote or advance consensus. There are limits on the amount of 53 : data that can be sent over. TODO: merge Tower & Replay tiles to 54 : remove this. */ 55 : 56 0 : #define FD_REPLAY_TOWER_VOTE_ACC_MAX (4096UL) 57 : #define FD_REPLAY_TOWER_ACC_DATA_MAX (4096UL) 58 : 59 : /* The minimal information Tower needs about a vote account at the end of a slot */ 60 : struct fd_replay_tower { 61 : fd_pubkey_t key; 62 : 63 : ulong stake; 64 : 65 : uchar acc[ FD_REPLAY_TOWER_ACC_DATA_MAX ]; 66 : ulong acc_sz; 67 : }; 68 : 69 : typedef struct fd_replay_tower fd_replay_tower_t; 70 : 71 : union fd_replay_message { 72 : fd_replay_slot_completed_t slot_completed; 73 : fd_replay_root_advanced_t root_advanced; 74 : fd_poh_reset_t reset; 75 : fd_became_leader_t became_leader; 76 : fd_replay_tower_t tower; 77 : }; 78 : 79 : typedef union fd_replay_message fd_replay_message_t; 80 : 81 : #endif /* HEADER_fd_src_discof_replay_fd_replay_tile_h */