shred_fetch: enforce fixed fec sets#7728
Conversation
e93ec43 to
b3ee5f3
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #7728 +/- ##
========================================
Coverage 83.0% 83.0%
========================================
Files 812 812
Lines 356934 357178 +244
========================================
+ Hits 296535 296814 +279
+ Misses 60399 60364 -35 🚀 New features to boost your workflow:
|
3f06a5d to
a55bcca
Compare
| recvr_stats: Option<Arc<StreamerReceiveStats>>, | ||
| sendr: EvictingSender<PacketBatch>, | ||
| bank_forks: &RwLock<BankForks>, | ||
| sharable_banks: &SharableBanks, |
| return true; | ||
| }; | ||
| let Some(fec_set_index) = layout::get_fec_set_index(shred) else { | ||
| stats.fec_set_index_bad_deserialize += 1; |
There was a problem hiding this comment.
these deserialize failures are already thrown out when we parse the shred in sigverify, this just moves it up - shouldn't be a consensus altering change no need to feature flag.
| /// all erasure sets contain exactly `DATA_SHREDS_PER_FEC_BLOCK` data and coding shreds: | ||
| /// - `index` is between `fec_set_index` and `fec_set_index + DATA_SHREDS_PER_FEC_BLOCK` | ||
| /// - `fec_set_index` is a multiple of `DATA_SHREDS_PER_FEC_BLOCK` | ||
| pub fn check_fixed_fec_set(index: u32, fec_set_index: u32) -> bool { |
There was a problem hiding this comment.
should we not have this together with basic shred format validation outside of blockstore code?
| /// Note: this check is critical to verify that the last fec set is sufficiently sized. | ||
| /// This currently is checked post insert in `Blockstore::check_last_fec_set`, but in the | ||
| /// future it can be solely checked during ingest | ||
| pub fn check_last_data_shred_index(index: u32) -> bool { |
There was a problem hiding this comment.
this also might be better suited inside shred.rs or similar.
|
Thank you, this looks great, left a couple of small nits |
a55bcca to
1b8fe3f
Compare
alexpyattaev
left a comment
There was a problem hiding this comment.
LGTM but please let @bw-solana also take a second look before merging.
Problem
See solana-foundation/solana-improvement-documents#317 for more details.
We wish to enforce that each FEC set has exactly 32 data and 32 coding shreds.
Summary of Changes
As outlined in the SIMD, we ignore any shreds that do not meet the index/fec_set_index requirements on ingest.
Specifically ensure that:
fec_set_indexis a multiple of 32fec_set_index <= index < fec_set_index + 32LAST_SHRED_IN_SLOTdata shred index must be== 31 (mod 32)ErasureConfigon all coding shreds must specify 32:32Note: this is a shred feature flag so it takes effect 1 epoch after normal feature activation
An alternate approach considered was performing the verification after ingest and marking the block as dead:
Some follow up work after FF activation:
fec_set_index,ErasureConfig, andproof_sizefrom shred headers.