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(share/byzantine): fix proof collection #2957

Merged
merged 7 commits into from
Dec 18, 2023

Conversation

vgonkivs
Copy link
Member

This PR fixes an issue in the proof collection method. Previously, we were sending len(dah.RowRoots)/2 requests in order to get proofs but there is a use case when the process can get stuck for a particular share(out-of-order case). The new approach sends n requests, where n is the number of non-empty shares received from rsmt2d library, and then waits until len(dah.RowRoots)/2 will be received.
I've also improved error handling as previously we were panicking in case any error appeared. The new approach will rely only on context.DeadlineExceeded which basically means that for some reason we can't get proofs, so the data is not available.

@vgonkivs vgonkivs added area:shares Shares and samples kind:fix Attached to bug-fixing PRs labels Nov 24, 2023
@vgonkivs vgonkivs self-assigned this Nov 24, 2023
@codecov-commenter
Copy link

codecov-commenter commented Nov 24, 2023

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Comparison is base (b7b6350) 50.88% compared to head (2eadddc) 51.01%.
Report is 1 commits behind head on main.

Files Patch % Lines
share/eds/byzantine/byzantine.go 66.66% 5 Missing and 1 partial ⚠️
das/daser.go 63.63% 3 Missing and 1 partial ⚠️
das/options.go 0.00% 4 Missing ⚠️
nodebuilder/das/constructors.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2957      +/-   ##
==========================================
+ Coverage   50.88%   51.01%   +0.12%     
==========================================
  Files         168      168              
  Lines       11021    11035      +14     
==========================================
+ Hits         5608     5629      +21     
+ Misses       4915     4903      -12     
- Partials      498      503       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Wondertan
Wondertan previously approved these changes Nov 27, 2023
Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

Changes here make sense. I would also add the test for the issue:

This PR fixes an issue in the proof collection method

share/eds/byzantine/byzantine.go Outdated Show resolved Hide resolved
share/eds/byzantine/byzantine.go Outdated Show resolved Hide resolved
Copy link
Member

@walldiss walldiss left a comment

Choose a reason for hiding this comment

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

Is it possible for n(number of non-empty shares received from rsmt2d library) to be less then len(dah.RowRoots)/2? I guess in this case proof collection won't be able to collect enough samples. So we should short circuit with error.

share/eds/byzantine/byzantine.go Outdated Show resolved Hide resolved
share/eds/byzantine/byzantine.go Outdated Show resolved Hide resolved
share/eds/byzantine/byzantine.go Show resolved Hide resolved
@vgonkivs
Copy link
Member Author

vgonkivs commented Dec 1, 2023

Is it possible for n(number of non-empty shares received from rsmt2d library) to be less then len(dah.RowRoots)/2

No, it's not possible to have n < len(dah.RowRoots)/2. Rsmt2d guarantees to return at least half of the row/col. iirc, "failed to solve data square" will be returned for the case that you mentioned.

Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

Good test

Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

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

good with me, nice find.

@ramin ramin enabled auto-merge (squash) December 18, 2023 12:01
@ramin ramin merged commit e38a7bf into celestiaorg:main Dec 18, 2023
15 of 17 checks passed
renaynay pushed a commit to renaynay/celestia-node that referenced this pull request Jan 15, 2024
This PR fixes an issue in the proof collection method. Previously, we
were sending `len(dah.RowRoots)/2` requests in order to get proofs but
there is a use case when the process can get stuck for a particular
share(out-of-order case). The new approach sends n requests, where n is
the number of non-empty shares received from rsmt2d library, and then
waits until `len(dah.RowRoots)/2` will be received.
I've also improved error handling as previously we were panicking in
case any error appeared. The new approach will rely only on
`context.DeadlineExceeded ` which basically means that for some reason
we can't get proofs, so the data is not available.

---------

Co-authored-by: ramin <raminkeene@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:shares Shares and samples kind:fix Attached to bug-fixing PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants