Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generates erasure codes in-place using mutable references into shreds' payload #4609

Merged
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
10 changes: 5 additions & 5 deletions ledger/src/shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ pub(crate) fn make_merkle_shreds_from_entries(
reed_solomon_cache,
stats,
)?;
Ok(shreds.into_iter().flatten().map(Shred::from).collect())
Ok(shreds.into_iter().map(Shred::from).collect())
}

// Accepts shreds in the slot range [root + 1, max_slot].
Expand Down Expand Up @@ -1385,6 +1385,7 @@ mod tests {
super::*,
assert_matches::assert_matches,
bincode::serialized_size,
itertools::Itertools,
rand::Rng,
rand_chacha::{rand_core::SeedableRng, ChaChaRng},
rayon::ThreadPoolBuilder,
Expand All @@ -1410,7 +1411,7 @@ mod tests {
data_size: usize,
chained: bool,
is_last_in_slot: bool,
) -> Result<Vec<Vec<merkle::Shred>>, Error> {
) -> Result<Vec<merkle::Shred>, Error> {
let thread_pool = ThreadPoolBuilder::new().num_threads(2).build().unwrap();
let chained_merkle_root = chained.then(|| Hash::new_from_array(rng.gen()));
let parent_offset = rng.gen_range(1..=u16::try_from(slot).unwrap_or(u16::MAX));
Expand Down Expand Up @@ -1567,8 +1568,8 @@ mod tests {
is_last_in_slot,
)
.unwrap();
assert_eq!(shreds.len(), 1);
let shreds: Vec<_> = shreds.into_iter().flatten().map(Shred::from).collect();
let shreds: Vec<_> = shreds.into_iter().map(Shred::from).collect();
assert_eq!(shreds.iter().map(Shred::fec_set_index).dedup().count(), 1);

assert_matches!(shreds[0].shred_type(), ShredType::Data);
let parent_slot = shreds[0].parent().unwrap();
Expand Down Expand Up @@ -2279,7 +2280,6 @@ mod tests {
)
.unwrap()
.into_iter()
.flatten()
.map(Shred::from)
.map(|shred| fill_retransmitter_signature(&mut rng, shred, chained, is_last_in_slot))
.collect();
Expand Down
Loading
Loading