Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions consensus/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,24 @@ use crate::state::{
/// - A M-notarization for a block, for the current view (it can be proposed by any replica)
/// - A L-notarization for a block, for the current view (it can be proposed by any replica)
/// - A nullification for a view, for the current view (it can be proposed by any replica)
/// - A block recovery request/response for fetching missing blocks from peers
#[derive(Clone, Debug, Archive, Deserialize, Serialize)]
pub enum ConsensusMessage<const N: usize, const F: usize, const M_SIZE: usize> {
BlockProposal(Block),
Vote(Vote),
Nullify(Nullify),
MNotarization(MNotarization<N, F, M_SIZE>),
Nullification(Nullification<N, F, M_SIZE>),
/// Request a missing block by view and expected hash. Sent when a replica has M-notarization
/// for a view but never received the actual block proposal from the leader.
BlockRecoveryRequest {
view: u64,
block_hash: [u8; 32],
},
/// Response containing the requested block. Sent by a peer that has the block in its
/// non-finalized view chain or finalized storage.
BlockRecoveryResponse {
view: u64,
block: Block,
},
}
18 changes: 18 additions & 0 deletions consensus/src/consensus_manager/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,22 @@ pub enum ViewProgressEvent<const N: usize, const F: usize, const M_SIZE: usize>
/// The starting view that triggered the nullification (where conflict was detected)
start_view: u64,
},

/// If the current replica should request a missing block from peers.
/// This happens when a view has received M-notarization (block_hash is known)
/// but the actual block proposal was never received from the leader.
ShouldRequestBlock {
/// The view number for which the block is missing.
view: u64,
/// The expected block hash (from the M-notarization).
block_hash: [u8; blake3::OUT_LEN],
},

/// If the current replica should request multiple missing blocks from peers.
/// This is the batch version of `ShouldRequestBlock`, used when multiple views
/// need block recovery simultaneously (e.g., after a node joins late).
ShouldRequestBlocks {
/// The list of (view, block_hash) pairs for which blocks are missing.
requests: Vec<(u64, [u8; blake3::OUT_LEN])>,
},
}
Loading