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

bug(fraud/befp): nmt can't validate a befp with out of order shares #2929

Closed
vgonkivs opened this issue Nov 15, 2023 · 4 comments
Closed

bug(fraud/befp): nmt can't validate a befp with out of order shares #2929

vgonkivs opened this issue Nov 15, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@vgonkivs
Copy link
Member

vgonkivs commented Nov 15, 2023

While working on out of order unit test for BEFP I realized that we can't prove the inclusion of lexicographically unordered shares:

Assuming an honest full node receives the eds with size 4:

N5  N2  N3  N4
N1  N6  N7  N8
N9  N10 N11 N12
N13 N14 N15 N16

where N5 > N1. . Also, this condition means that N5 is the biggest namespace within the first row.
This will mean that during the reconstruction of the 1st quadrant, we can have ErrByzantineData for the first row or col. After getting this error from the rsmt2d, the node starts collecting proofs and creating the Bad Encoding Fraud Proof. BEFP consists of the bad shares + respective nmt proofs, so at some point, the verifier has to check whether these shares are committed to the data root or not. But the verification will be failed on this step with ErrInvalidNodeNamespaceOrder. As we could not prove the inclusion of the received shares, this FN will be blocked because it could not reconstruct the data square and could not prove the BEFP.

PS. I need to perform more testing, but I'm sure that the result will be the same as I've described above.
PS/2 Changing VerifyInclusion to VerifyLeafHashes won't help either

@vgonkivs vgonkivs added the bug Something isn't working label Nov 15, 2023
@vgonkivs vgonkivs changed the title bug(fraud/befp): out of order shares could be validated using nmt.Proof bug(fraud/befp): out of order shares could not be validated using nmt.Proof Nov 15, 2023
@vgonkivs vgonkivs changed the title bug(fraud/befp): out of order shares could not be validated using nmt.Proof bug(fraud/befp): nmt can't validate a befp with out of order shares Nov 16, 2023
@musalbas
Copy link
Member

Per this discussion, there is no need to prove the inclusion of lexicographically unordered shares. Is there any recent thinking that invalidates this?

@adlerjohn
Copy link
Member

BEFP consists of the bad shares + respective nmt proofs, so at some point, the verifier has to check whether these shares are committed to the data root or not

I think this is where the incorrect assumption is: a BEFP consists of half of the shares of a row/col, not bad shares specifically. The bad shares (e.g. an out-of-order share) can be recovered. Indeed, if the invalid block is due to a out-of-order share, then the only way for a verifier to get that shares is through recovering it.

I'm not sure why the line https://github.com/celestiaorg/nmt/blob/9adb4090697dcf4d17a5ebb60dd042312fb27b68/proof.go#L418 is related to shares though. It looks like it only checks the root at that line?

@vgonkivs
Copy link
Member Author

Is there any recent thinking that invalidates this?

No, I missed the thing that it's not possible to get proofs for out-of-order shares and we should not consider this as a bug.

https://github.com/celestiaorg/nmt/blob/9adb4090697dcf4d17a5ebb60dd042312fb27b68/proof.go#L418 is related to shares though. It looks like it only checks the root at that line?

It checks the min/max namespace id and finds that max namespace is less than the min namespace but the fact that we can't get proofs from the data root where shares are out of order proves that it's not possible to get here.

@vgonkivs
Copy link
Member Author

Thanks for the help @musalbas and @adlerjohn. Closing this issue as not relevant anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants