solana_runtime/vote_sender_types.rs
1use {
2 crossbeam_channel::{Receiver, Sender},
3 solana_clock::{BankId, Slot},
4 solana_hash::Hash,
5 solana_vote::vote_parser::ParsedVote,
6};
7
8/// Message sent by banking and replay to the solCiProcVotes thread to update its state machine.
9///
10/// Banking sends VerifiedExecuted(vote) as it builds a block, and solCiProcVotes processes those
11/// votes immediately.
12///
13/// Replay runs sigverify and execution in parallel, and sends Verified and Executed respectively as
14/// those stages complete. solCiProcVotes waits until it has received both messages for the same
15/// vote transaction before processing it.
16#[derive(Clone, Debug, PartialEq, Eq)]
17pub enum ReplayVoteMessage {
18 /// The vote was sigverified and executed
19 VerifiedExecuted(ParsedVote),
20 /// The vote was executed, but sigverify might not have finished yet
21 Executed {
22 replay_bank_id: BankId,
23 replay_slot: Slot,
24 message_hash: Hash,
25 parsed_vote: ParsedVote,
26 },
27 /// The votes were sigverified.
28 Verified {
29 replay_bank_id: BankId,
30 replay_slot: Slot,
31 message_hashes: Vec<Hash>,
32 },
33 /// The bank is invalid no more votes should be processed.
34 ///
35 /// This is informative and used to release memory early. If not sent (like
36 /// in some replay error paths), memory will be released as slots are rooted.
37 InvalidBank {
38 replay_bank_id: BankId,
39 replay_slot: Slot,
40 },
41 /// The bank is complete.
42 ///
43 /// Like InvalidBank this is informative and used to release memory early.
44 BankComplete {
45 replay_bank_id: BankId,
46 replay_slot: Slot,
47 },
48}
49
50#[derive(Clone, Copy, Debug, PartialEq, Eq)]
51pub enum ReplayVoteSendType {
52 VerifiedExecuted,
53 Executed {
54 replay_bank_id: BankId,
55 replay_slot: Slot,
56 },
57}
58
59pub type ReplayVoteSender = Sender<ReplayVoteMessage>;
60pub type ReplayVoteReceiver = Receiver<ReplayVoteMessage>;