-
Notifications
You must be signed in to change notification settings - Fork 45
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
The updateMinMaxID method disregards the IgnoreMaxNamespace
semantic
#159
Comments
@liamsi I would appreciate your thoughts on this 🙏 |
Ok, so this is not intentional and should be easy to fix: the private fields @Wondertan @vgonkivs does this impact Celestia node's logic in any way? tldr are the proofs for parity namespaces expected to be non-empty in node? |
Thanks @liamsi for your input and clarification. So, given that this is has not been an intential behaviour of the nmt, I am going to implement the fix.
Agree with this, it is important to understand the implications of this fix on celestia-node. |
@liamsi Another question regarding the |
I am not sure why that would that be needed? In Celestia: for the first half of the tree, the namespace range is reflected in the root. For the second half, the namespace is always the same and also known: it's the parity/max namespace. |
It should be possible to prove that a parity leaf is part of the tree though 🤔 |
Reposting my comment from Slack in here:
I understand your point about Celestia's data square rows and columns. When all shares are pushed to the NMT, the tree structure has a specific structure known to the application. However, if one wants to determine the NMT's namespace range at an arbitrary point in the code (not only when all the shares are pushed), the tree alone does not provide information about the actual NID range. Therefore, the application must keep track of the data that has been added to the tree to determine the NID range.
Right, and it is possible using the index of a parity share i.e., the index of the leaf in the NMT. |
Celestia-node uses The maxNID is only used by ProveNamespace which is untouched by Celestia-node. Instead, we build inclusion proofs with the lower level NewInclusionProof, by reading out proofs from disk. |
Problem
The utility method updateMinMaxID in nmt.go does not consider the
IgnoreMaxNamespace
semantic when updating themaxNID
field of theNamespacedMerkleTree
after each leaf is pushed using Push. This leads to inconsistency between the name ID range stored byNamespacedMerkleTree.minID
andNamespacedMerkleTree.maxID
and the name ID range extracted from the NMT via its MaxNamespace() method, which looks at the NMT's root name ID range affected by theignoreMaxNamespace
logic.Note that the values
NamespacedMerkleTree.minID
andNamespacedMerkleTree.maxID
are used to compare queried NIDs when creating namespace proofs, as shown in this part of the code. This means that queries for the max namespace ID (i.e., parity share name ID), wont be responded by an empty proof. This is against the original purpose of theIgnoreMaxNamespace
flag.Below is a sample test to demonstrate the inconsistency set out in this issue:
Acceptance Criteria
This issue is to decide on the correct behavior (is this inconsistency intentional or not) and make the necessary changes to resolve this inconsistency (or document the rationale of this inconsistency).
The text was updated successfully, but these errors were encountered: