-
Notifications
You must be signed in to change notification settings - Fork 931
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
Update BEFP creation and validation to accomodate more types of validator fraud #2377
Comments
🤔 |
@evan-forbes, thank you for the detailed issue! Do I understand correctly that the actionable here is to ensure that steps 2 and 3 are followed(and tested) in the implementation? |
yeah in celestia-node, I believe so yeah. I'm still unsure exactly on what (if anything) needs to be changed on the reconstruction side. |
Likely relevant celestiaorg/rsmt2d#178 |
The problem here is that if two shares of the row will be out of order, then we can't compute the Merkle root of this row, because of this. This means that computeSharesRoot will also return an error that is different from ErrByzantineData.
I guess for this case we will need a different type of fraud proof because validation will defer from BEFP validation. @adlerjohn could you please confirm that my understanding is correct? Also, I think we will need additional implementation from the rsmt2d side. |
In case we can't build Merkle roots for both row and col, then the entire data is not available |
is there any way that the BEFP struct that light clients get can be the same? or perhaps we can modify the existing one to handle both cases? In theory, a BEFP just needs any inclusion proof (to row or col roots) for half the shares in a row, correct? |
Yes. But with the current implementation, we are verifying inclusion against a single row/col root. New validation requires multiple roots(each share will have its own root to verify from). |
What we can do is to have a slice of |
Yes, that's correct.
We don't need a different data structure, we just need additional codepaths in the verification logic to handle the two additional cases described in OP. The data structure of the proof can remain the same. |
Regarding the above proposed way to handle that case, what if both the col and row has shares out of order? Isn't the solution simply for the BEFP verifier to try and recompute the row/col root, which will error because one of the shares is out of order, and then fraud proof passes? |
I believe that since both the row and col are out of order, then when the verifier attempts to first prove inclusion to those shares, it will fail since both are out of order. |
But it will mean that the BEFP is invalid. |
yeah currently that is the case and we will fix to close this PR, correct?
to clarify this with the above statement in the OP
afaiu, we don't have to do anything for the case where both the row and col are out of order, since either the square is available and there exists row/col where the shares can be proven using the opposite col/row roots, or the entire square is not available (sample verification cannot occur because inclusion proofs fail due to nodes in the tree being out of order) |
Let's think about the end-to-end flow of sampling and reconstruction. Note that shares being out of order is not the only case where you cannot recompute a row or column root; this would also be the case if any reconstructed shares do not match the row or column root. We can conceptually treat an out-of-order share as the same as a recomputed share that does not match the row or column root. Firstly, it should not be possible to sample a share that has any sibling nodes that are out of order, because the proof NMT verification will fail when it tries to reconstruct the root (due to a mismatch when calculating min and max nid). Next, we should consider this rule:
From the above, it doesn't seem to me like we need to create inclusion proofs ourselves in rows/cols with shares out of order, due to (2). Does that seem right @adlerjohn @evan-forbes? |
I'm thinking it might be possible if an attacker modifies the NMT code to simply process out-of-order leaves, and the Merkle proof is for a leaf whose neighbor isn't out of order. But this is fine because the case will be caught when the full row/col is reconstructed anyways.
That's correct, yes. |
Exactly. |
Per this comment in nmt defining the attack scenario:
per the LL white paper section 5.2
addionally, 2/3s of the voting power could commit to shares that not sized properly and would result in an inability to decode the row or col.
We need to have a fraud proof that can handle out of order namespaces and arbitary things that would cause the erasure decoding to fail. BEFPs (perhaps need to be renamed after this), can and should handle these types of fraud.
During the reconstruction process, if there are two shares that are out of order, then we should still be able to create an inclusion proof to half of the shares in that row or col using either the row or column roots. If the square is available, then this will always be the case.
For the second new type of fraud, if there is something wrong with the shares that would cause the row or col to not be decodable, then if the shares are committed to (step 1 below), then that means that the BEFP is valid.
To accomodate this, the verification logic must be altered to encode the following logic:
currently, we are not following steps two and three of the validation process:
celestia-node/share/eds/byzantine/bad_encoding.go
Lines 162 to 184 in 6654cdf
cc @renaynay @Wondertan please feel free to add issues, edit, or convert this to an EPIC as needed 🙂
The text was updated successfully, but these errors were encountered: