Skip to content

Commit

Permalink
retains chained Merkle root across leader slots (#1057)
Browse files Browse the repository at this point in the history
Looking up Merkle root of the last erasure batch for the parent block
can fail if the slot-meta is not yet available in blockstore.
This commit instead retains chained Merkle root across leader slots. If
the parent of the current block is the previous leader slot, then the
chained Merkle root is readily available and we can bypass blockstore
lookup.
  • Loading branch information
behzadnouri authored May 3, 2024
1 parent 2635aaa commit 6b45dc9
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 198 deletions.
2 changes: 2 additions & 0 deletions turbine/src/broadcast_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ pub enum Error {
Blockstore(#[from] solana_ledger::blockstore::BlockstoreError),
#[error(transparent)]
ClusterInfo(#[from] solana_gossip::cluster_info::ClusterInfoError),
#[error("Duplicate slot broadcast: {0}")]
DuplicateSlotBroadcast(Slot),
#[error("Invalid Merkle root, slot: {slot}, index: {index}")]
InvalidMerkleRoot { slot: Slot, index: u64 },
#[error(transparent)]
Expand Down
9 changes: 0 additions & 9 deletions turbine/src/broadcast_stage/broadcast_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ pub(super) struct ReceiveResults {
pub last_tick_height: u64,
}

#[derive(Clone)]
pub struct UnfinishedSlotInfo {
pub(super) chained_merkle_root: Hash,
pub next_shred_index: u32,
pub(crate) next_code_index: u32,
pub slot: Slot,
pub parent: Slot,
}

pub(super) fn recv_slot_entries(receiver: &Receiver<WorkingBankEntry>) -> Result<ReceiveResults> {
let target_serialized_batch_byte_count: u64 =
32 * ShredData::capacity(/*merkle_proof_size*/ None).unwrap() as u64;
Expand Down
Loading

0 comments on commit 6b45dc9

Please sign in to comment.