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): use any available axis for befp nmt proofs construction #3306

Merged
merged 8 commits into from
Apr 23, 2024

Conversation

walldiss
Copy link
Member

@walldiss walldiss commented Apr 10, 2024

We should not restrict the BEFP constructor to collect proof only for orthogonal axes to ErrByzantine. This PR enables the constructor to attempt building both Row and Col proofs, irrespective of the ErrByzantine axis type. Additionally, it prevents the BEFP constructor from requesting proofs pr shars from the network by granting access exclusively to the local blockstore. There should be sufficient proofs and shares in the local blockstore at the time BEFP is detected.

Breaks befp message, by introducing proofAxis field, which is not supported by older befp subscribers.

Depends on

@walldiss walldiss added area:shares Shares and samples kind:fix Attached to bug-fixing PRs labels Apr 10, 2024
@walldiss walldiss self-assigned this Apr 10, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 10, 2024

Codecov Report

Attention: Patch coverage is 67.27273% with 36 lines in your changes are missing coverage. Please review.

Project coverage is 45.01%. Comparing base (2469e7a) to head (eaa288b).
Report is 30 commits behind head on main.

Files Patch % Lines
share/eds/byzantine/pb/share.pb.go 0.00% 22 Missing and 2 partials ⚠️
share/eds/byzantine/share_proof.go 86.44% 7 Missing and 1 partial ⚠️
share/eds/byzantine/byzantine.go 73.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3306      +/-   ##
==========================================
+ Coverage   44.83%   45.01%   +0.17%     
==========================================
  Files         265      272       +7     
  Lines       14620    15162     +542     
==========================================
+ Hits         6555     6825     +270     
- Misses       7313     7569     +256     
- Partials      752      768      +16     

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

@Wondertan
Copy link
Member

Needs review from the author - @vgonkivs

share/eds/byzantine/byzantine.go Outdated Show resolved Hide resolved
share/eds/byzantine/pb/share.proto Show resolved Hide resolved
share/eds/byzantine/share_proof.go Outdated Show resolved Hide resolved
share/eds/byzantine/bad_encoding.go Outdated Show resolved Hide resolved
share/eds/byzantine/byzantine.go Outdated Show resolved Hide resolved
share/eds/byzantine/share_proof.go Outdated Show resolved Hide resolved
@walldiss walldiss requested a review from Wondertan April 13, 2024 16:06
Wondertan
Wondertan previously approved these changes Apr 16, 2024
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.

Great find, seriously. It should have become obvious to us after we realized that the server is responsible for selecting the proof when we sample and it did become👍🏻

share/eds/byzantine/share_proof.go Show resolved Hide resolved
vgonkivs
vgonkivs previously approved these changes Apr 18, 2024
@vgonkivs
Copy link
Member

--- FAIL: TestBEFP_ValidateOutOfOrderShares (0.00s)
    bad_encoding_test.go:241: 
        	Error Trace:	/home/runner/work/celestia-node/celestia-node/share/eds/byzantine/bad_encoding_test.go:241
        	Error:      	Received unexpected error:
        	            	incorrect share received
        	Test:       	TestBEFP_ValidateOutOfOrderShares
FAIL
coverage: 13.2% of statements

@walldiss walldiss dismissed stale reviews from vgonkivs and Wondertan via eaa288b April 18, 2024 19:12
@walldiss
Copy link
Member Author

I had to remove concurrent fetching of ShareWithProof code to resolve flakiness of unit tests. Also looks much simpler now. Performance downside is not important, as we collect shares from disk and it is still fast enough being sequential instead of concurrent.

@walldiss walldiss added the kind:break! Attached to breaking PRs label Apr 19, 2024
@walldiss walldiss changed the title fix(share/byzantine): use any available axis for befp nmt proofs construction fix!(share/byzantine): use any available axis for befp nmt proofs construction Apr 19, 2024
@Wondertan Wondertan enabled auto-merge (squash) April 21, 2024 15:02
@Wondertan Wondertan merged commit 116af74 into celestiaorg:main Apr 23, 2024
26 checks passed
Comment on lines +37 to +41
switch axisType {
case rsmt2d.Row:
rootHash = rootHashForCoordinates(dah, s.Axis, shrIdx, axisIdx)
case rsmt2d.Col:
rootHash = rootHashForCoordinates(dah, s.Axis, axisIdx, shrIdx)
Copy link
Contributor

@oblique oblique Jul 16, 2024

Choose a reason for hiding this comment

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

I'm evaluating your changes to port them into Rust's celestia-types.

Correct me if I'm wrong but isn't this the same as the following?

	switch s.Axis {
	case rsmt2d.Row:
		rootHash = dah.RowRoots[axisIdx]
	case rsmt2d.Col:
		rootHash = dah.ColumnRoots[axisIdx]

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:break! Attached to breaking PRs kind:fix Attached to bug-fixing PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants