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

Fix segment reconstruction #1850

Merged
merged 3 commits into from
Aug 21, 2023
Merged

Fix segment reconstruction #1850

merged 3 commits into from
Aug 21, 2023

Conversation

nazar-pc
Copy link
Member

This time bug is really funny and here is what was happening:

  • Piece is missing on DSN, reconstruction kicks in
  • Reconstructor (unnecessarily, see second commit) prefers source pieces (which works in many cases, but not always, it is async after all)
  • If all source pieces are successfully acquired, reconstructor doesn't recover pieces (only commitments and witnesses from source pieces)
  • Despite retrieving all valid pieces we end up with a broken reconstructed piece

Reconstructor had an optimization that had incorrect assumptions. The funny thing is that it always worked if source piece was actually missing, but as long as input for reconstruction contained 100% source pieces things didn't work basically at all. Test wasn't checking this unexpected edge case, during DSN sync we never needed to reconstruct parity pieces.

The fix is to simply remove unnecessary condition checking for all source pieces being present (ignore whitespaces to see how small and trivial diff is).

Fixes #1837

Code contributor checklist:

@nazar-pc
Copy link
Member Author

Test failed due to grandinetech/rust-kzg#236 that had 2 issues combined, one of which incorrect usage of unwrap (again). I'll wait for them to fix it or will get there myself if they don't in a reasonable amount of time.

@nazar-pc nazar-pc disabled auto-merge August 21, 2023 03:22
@nazar-pc nazar-pc merged commit c93e9f5 into main Aug 21, 2023
@nazar-pc nazar-pc deleted the fix-segment-reconstruction branch August 21, 2023 05:41
@nazar-pc nazar-pc added the need to audit This change needs to be audited label Sep 11, 2023
@vanhauser-thc vanhauser-thc added audited This change was audited and removed need to audit This change needs to be audited labels Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audited This change was audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Solutions rejected (InvalidPiece, InvalidChunkWitness)
3 participants