Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

adds more sanity checks to shreds#21675

Merged
behzadnouri merged 1 commit intosolana-labs:masterfrom
behzadnouri:shred-sanitize
Dec 9, 2021
Merged

adds more sanity checks to shreds#21675
behzadnouri merged 1 commit intosolana-labs:masterfrom
behzadnouri:shred-sanitize

Conversation

@behzadnouri
Copy link
Copy Markdown
Contributor

Problem

shreds inner fields need sanity checks.

Summary of Changes

added sanity checks

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 7, 2021

Codecov Report

Merging #21675 (eaca402) into master (0224a8b) will decrease coverage by 0.2%.
The diff coverage is 89.2%.

@@            Coverage Diff            @@
##           master   #21675     +/-   ##
=========================================
- Coverage    81.6%    81.4%   -0.3%     
=========================================
  Files         511      511             
  Lines      143320   143453    +133     
=========================================
- Hits       116976   116795    -181     
- Misses      26344    26658    +314     

Comment thread ledger/src/shred.rs Outdated
self.common_header.fec_set_index
}

// Returns true if the shred sanity checks.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if the shred passes sanity checks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Comment thread ledger/src/shred.rs Outdated
ShredType::Data => {
let parent_offset = Slot::try_from(self.data_header.parent_offset);
self.slot().checked_sub(parent_offset.ok()?)
// TODO What if parent_offset is zero and slot != 0?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the call to this filter in window service will drop the shred

Some(parent) => blockstore::verify_shred_slots(shred.slot(), parent, root),

if parent_slot >= slot {
   return false;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

carllin
carllin previously approved these changes Dec 9, 2021
@mergify mergify Bot dismissed carllin’s stale review December 9, 2021 14:29

Pull request has been modified.

@behzadnouri behzadnouri merged commit 8063273 into solana-labs:master Dec 9, 2021
@behzadnouri behzadnouri deleted the shred-sanitize branch December 9, 2021 16:44
mergify Bot pushed a commit that referenced this pull request Dec 9, 2021
mergify Bot added a commit that referenced this pull request Dec 9, 2021
(cherry picked from commit 8063273)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
@brooksprumo brooksprumo mentioned this pull request Jan 5, 2022
mergify Bot pushed a commit that referenced this pull request Feb 1, 2022
(cherry picked from commit 8063273)

# Conflicts:
#	ledger/src/blockstore.rs
mergify Bot added a commit that referenced this pull request Feb 1, 2022
* adds more sanity checks to shreds (#21675)

(cherry picked from commit 8063273)

# Conflicts:
#	ledger/src/blockstore.rs

* removes mergify merge conflicts

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants