-
Notifications
You must be signed in to change notification settings - Fork 2
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
IgnoreMaxNS leads to false computing maxNs #39
Comments
I have wrote a test for this case. The test is located in an forked nmt repo in the hasher_test.go file. It is named Test_IgnoreMaxNamespace_HashNode. |
Also, as you mentioned in our online discussion, there seems to exist an assumption for usages of the libraries that
(quoting from the outdated spec) |
Thank you for providing more details regarding the
Thus, as mentioned in this issue, the I think, even if we were to fall back to As such, the example provided in the issue description would not happen while constructing NMTs from Celestia block data. However, to simplify the @evan-forbes @liamsi would like to know your thoughts as well. |
Thanks, @staheri14 ! The first one would be to explicitly mention the property that by design, the minimum and maximum namespace IDs of a node will both be PARITY_SHARE_NAMESPACE_ID or neither will be (except for the root) among the assumptions of the NMT library. The second one, as you suggest, would be to not rely on that property at all by including The preferred approach is perhaps connected to NMT issue 121, where a different assumption (the one about order between leaves) is discussed. |
the second option of simplifying ignoreMaxNs seems like a good option afaiu |
Closed by the mirror issue celestiaorg/nmt#148 |
@evan-forbes and @staheri14 Here is the description of the issue about computing
maxNs
withn.ignoreMaxNS
set to true that we discussed about.We are not sure what is the expected behavior when it comes to calculating
maxNs
withn.ignoreMaxNS
set to true.As we understand the expected behavior under these conditions is to choose a
maxNs
that is less thann.precomputedMaxNs
if possible. If this is the case there might be an issue with computingmaxNs
here, which can lead to setting it ton.precomputedMaxNs
even if it could be set to a namespaceId that is smaller thann.precomputedMaxNs
.If we assume the following:
n.ignoreMaxNS = true
leftMinNs != n.precomputedMaxNs
rightMaxNs = n.precomputedMaxNs
rightMinNs < n.precomputedMaxNs
rightMinNs>leftMaxNs
.Than the
maxNs
will be set ton.precomputedMaxNs
even if it should be set torightMinNs
because it is the largest namespaceId smaller thann.precomputedMaxNs
.Example with numbers (presented also in the image at the end):
Lets assume that following:
Based on this logic in
HashNode
theminNs
and `maxNs' for the node that is being calculated will take the following values:precomputedMaxNs
(because theelse
branch of the if statement will be executed and there 10 will obviously be chosen even if theright.minNs
is larger thenleft.maxNs
but not equal toprecomputedMaxNs
).This numerical example with the current behavior and the behavior we expect is graphically presented in the following image.
The text was updated successfully, but these errors were encountered: