forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 1k
Blockstore: fix last tests using legacy shreds #7308
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5315,7 +5315,7 @@ pub mod tests { | |
| crate::{ | ||
| genesis_utils::{create_genesis_config, GenesisConfigInfo}, | ||
| leader_schedule::{FixedSchedule, IdentityKeyedLeaderSchedule}, | ||
| shred::{max_ticks_per_n_shreds, ShredFlags}, | ||
| shred::max_ticks_per_n_shreds, | ||
| }, | ||
| assert_matches::assert_matches, | ||
| bincode::{serialize, Options}, | ||
|
|
@@ -7542,18 +7542,25 @@ pub mod tests { | |
| index | ||
| ); | ||
|
|
||
| // Add a shred from different fec set | ||
| let shredder = Shredder::new(slot, slot.saturating_sub(1), 0, 0).unwrap(); | ||
| let keypair = Keypair::new(); | ||
| let reed_solomon_cache = ReedSolomonCache::default(); | ||
| let new_index = fec_set_index + 31; | ||
| let new_data_shred = Shred::new_from_data( | ||
| slot, | ||
| new_index, | ||
| 1, // parent_offset | ||
| &[3, 3, 3], // data | ||
| ShredFlags::empty(), | ||
| 0, // reference_tick, | ||
| 0, // version | ||
| fec_set_index + 30, | ||
| ); | ||
| // Add a shred from different fec set | ||
| let new_data_shred = shredder | ||
| .make_shreds_from_data_slice( | ||
| &keypair, | ||
| &[3, 3, 3], | ||
| false, | ||
| Some(Hash::default()), | ||
| new_index, | ||
| new_index, | ||
| &reed_solomon_cache, | ||
| &mut ProcessShredsStats::default(), | ||
| ) | ||
| .unwrap() | ||
| .next() | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we generate full FEC set as usual but only pick the first shred, which should have the exact index we need. |
||
| .unwrap(); | ||
|
|
||
| let mut shred_insertion_tracker = | ||
| ShredInsertionTracker::new(data_shreds.len(), blockstore.db.batch().unwrap()); | ||
|
|
@@ -7868,16 +7875,25 @@ pub mod tests { | |
| ); | ||
|
|
||
| // Insert an empty shred that won't deshred into entries | ||
| let shreds = vec![Shred::new_from_data( | ||
| slot, | ||
| next_shred_index as u32, | ||
| 1, | ||
| &[1, 1, 1], | ||
| ShredFlags::LAST_SHRED_IN_SLOT, | ||
| 0, | ||
| 0, | ||
| next_shred_index as u32, | ||
| )]; | ||
|
|
||
| let shredder = Shredder::new(slot, slot.saturating_sub(1), 0, 0).unwrap(); | ||
| let keypair = Keypair::new(); | ||
| let reed_solomon_cache = ReedSolomonCache::default(); | ||
|
|
||
| let shreds: Vec<Shred> = shredder | ||
| .make_shreds_from_data_slice( | ||
| &keypair, | ||
| &[1, 1, 1], | ||
| true, | ||
| Some(Hash::default()), | ||
| next_shred_index as u32, | ||
| next_shred_index as u32, | ||
| &reed_solomon_cache, | ||
| &mut ProcessShredsStats::default(), | ||
| ) | ||
| .unwrap() | ||
| .take(DATA_SHREDS_PER_FEC_BLOCK) | ||
| .collect(); | ||
|
|
||
| // With the corruption, nothing should be returned, even though an | ||
| // earlier data block was valid | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this +30 here seems a bit odd here, not sure what it is trying to achieve.