-
Notifications
You must be signed in to change notification settings - Fork 43
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
chore: fixes the HashLeaf description #92
Conversation
Codecov Report
@@ Coverage Diff @@
## master #92 +/- ##
=======================================
Coverage 96.21% 96.21%
=======================================
Files 6 6
Lines 423 423
=======================================
Hits 407 407
Misses 10 10
Partials 6 6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
// ns(rawData) || ns(rawData) || hash(leafPrefix || rawData), where raw data is the leaf's | ||
// data minus the namespaceID (namely leaf[NamespaceLen:]). | ||
// ns(leaf) || ns(leaf) || hash(leafPrefix || leaf), where ns(leaf) is the namespaceID | ||
// inside the leaf's data namely leaf[:n.NamespaceLen]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is clearer as it is aligned with the naming of the actual variable (leaf
). I think the original comment was a somewhat confusing attempt to say that the leaf
contains both the namespace + the raw data. This is still implicitly there ("where ns(leaf) is the namespaceID inside the leaf's data namely leaf[:n.NamespaceLen])".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! 👍 LGTM
Congrats, your important contribution to this open-source project has earned you a GitPOAP! GitPOAP: 2023 Celestia Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
Overview
While reviewing the nmt codebase (as part of this EPIC) I realized the description of the
HashLeaf
function does not match its implementation (w.r.t. referred variable names) which causes confusion when comprehending the code. This PR aims to correct and revise that description.Also, the illustration of an nmt provided in the Readme file seems not aligned with the leaf hash calculation, where in the
node_0.0
thed_0.0=H(data_0)
while it should bed_0.0=H(0x00, nid_0, data_0)
. I was not able to edit the image as its source code is not available.