Skip to content

Commit

Permalink
enables merkle shreds for devnet and development clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
behzadnouri committed Jul 19, 2023
1 parent 3b8bcb4 commit 567d1ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ledger/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6163,7 +6163,8 @@ pub mod tests {
let gap: u64 = 10;
assert!(gap > 3);
// Create enough entries to ensure there are at least two shreds created
let num_entries = max_ticks_per_n_shreds(1, None) + 1;
let data_buffer_size = ShredData::capacity(/*merkle_proof_size:*/ None).unwrap();
let num_entries = max_ticks_per_n_shreds(1, Some(data_buffer_size)) + 1;
let entries = create_ticks(num_entries, 0, Hash::default());
let mut shreds =
entries_to_test_shreds(&entries, slot, 0, true, 0, /*merkle_variant:*/ false);
Expand Down
2 changes: 1 addition & 1 deletion ledger/src/shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ pub fn max_entries_per_n_shred(
num_shreds: u64,
shred_data_size: Option<usize>,
) -> u64 {
let data_buffer_size = ShredData::capacity(/*merkle_proof_size:*/ None).unwrap();
let data_buffer_size = ShredData::capacity(/*merkle_proof_size:*/ Some(6)).unwrap();
let shred_data_size = shred_data_size.unwrap_or(data_buffer_size) as u64;
let vec_size = bincode::serialized_size(&vec![entry]).unwrap();
let entry_size = bincode::serialized_size(entry).unwrap();
Expand Down
8 changes: 5 additions & 3 deletions turbine/src/broadcast_stage/standard_broadcast_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,9 @@ impl BroadcastRun for StandardBroadcastRun {
fn should_use_merkle_variant(slot: Slot, cluster_type: ClusterType, shred_version: u16) -> bool {
match cluster_type {
ClusterType::Testnet => shred_version == 28353,
_ => (slot % 19) == 1,
ClusterType::MainnetBeta => (slot % 19) == 1,
ClusterType::Devnet => true,
ClusterType::Development => true,
}
}

Expand Down Expand Up @@ -788,13 +790,13 @@ mod test {
}
// At least as many coding shreds as data shreds.
assert!(shreds.len() >= 29 * 2);
assert_eq!(shreds.iter().filter(|shred| shred.is_data()).count(), 29);
assert_eq!(shreds.iter().filter(|shred| shred.is_data()).count(), 30);
process_ticks(75);
while let Ok((recv_shreds, _)) = brecv.recv_timeout(Duration::from_secs(1)) {
shreds.extend(recv_shreds.deref().clone());
}
assert!(shreds.len() >= 33 * 2);
assert_eq!(shreds.iter().filter(|shred| shred.is_data()).count(), 33);
assert_eq!(shreds.iter().filter(|shred| shred.is_data()).count(), 34);
}

#[test]
Expand Down

0 comments on commit 567d1ea

Please sign in to comment.