-
Notifications
You must be signed in to change notification settings - Fork 286
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
doc: revises the namespace specifications and includes some clarifications #2124
Conversation
|
Codecov Report
@@ Coverage Diff @@
## main #2124 +/- ##
=======================================
Coverage 25.05% 25.05%
=======================================
Files 121 121
Lines 13811 13811
=======================================
Hits 3460 3460
Misses 9995 9995
Partials 356 356 |
…te' into sanaz/namespace-specs-audit-update
## Protobuf Definition | ||
|
||
<!-- TODO: Add protobuf definition for namespace --> |
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.
Does namespace actually have protobuf definitions?
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.
Not sure either, it is a placeholder just in case we have, or we want to have a protobuf definition. Please see #2128.
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.
Personally I don't see the use. I think it's adequate to have it represented as an array of bytes
specs/src/specs/namespace.md
Outdated
|
||
## Reserved Namespaces | ||
|
||
Celestia reserves certain namespaces with specific meanings. | ||
Applications SHOULD refrain from using these reserved namespaces for their blob data. <!-- the implication of this is still under investigation, but it is prudent to advise app developers not using this namespace --> |
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.
Isn't it straight up infeasible to use these reserved namespaces
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.
This sentence aims to provide clarity to app developers regarding the consequences of overlooking reserved namespaces and using them for their blobs.
Isn't it straight up infeasible to use these reserved namespaces
Can you please expand on this part? Why it is infeasible? Is it part of the transaction validity rules? where this check is done? What happens if a blob's namespace has a reserved namespace?
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.
Ok, found the answer in the code, changed SHOULD
to MUST
in f171508.
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.
One question @rootulp: The expected behavior is to reject blob transactions with reserved namespaces? right? asking this for the code audit's sake
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.
Yes, it would be rejected in ProcessProposal
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.
The expected behavior is to reject blob transactions with reserved namespaces?
Yes.
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.
Yes, it would be rejected in ProcessProposal
@cmwaters If it is checked during ProcessProposal
, then how would the tx sender be informed that its transaction was invalid? or they are not informed?
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.
A few questions and one blocking comment regarding usage of "SHOULD"
The version is used to determine the format of the namespace and | ||
is encoded as a single byte. |
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.
[question] semantic line breaks are new for me so I don't understand why a line break was introduced in the middle of this sentence.
Was it added to conform to maximum line length character requirements?
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.
The line break is added here because the second part, "is encoded as a single byte," conveys a separate and independent message from the first part. By moving it to the next line, we ensure clarity and emphasize the distinction between the two ideas.
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 for clarifying! TBH it's not immediately obvious to me when to introduce a semantic line break but I think it's safe to keep one here :)
I guess we could also rewrite this as two sentences:
The version is used to determine the format of the namespace.
The version is encoded as a single byte.
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.
TBH it's not immediately obvious to me when to introduce a semantic line break but I think it's safe to keep one here :)
As a general guideline, it is usually recommended to add a line break after each ending period. However, there are other instances where we may want to break a line in the middle. In such cases, a helpful mental model is to view it as commit messages. Similar to keeping each commit short and self-contained, we can break down different semantically independent messages of a line into separate lines, using line breaks.
I guess we could also rewrite this as two sentences:
Yes, Your suggested approach also works.
The namespace ID is a 28 byte identifier that uniquely identifies a namespace. The ID is encoded as a byte slice of length 28. | ||
The namespace ID is a 28 byte identifier that uniquely identifies a namespace. | ||
The ID is encoded as a byte slice of length 28. | ||
<!-- It may be useful to indicate the endianness of the encoding) --> |
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.
[question] is endianess applicable for a byte slice that doesn't inherently represent some value?
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.
that doesn't inherently represent some value?
Can you provide further clarification on this specific section?
The interpretation of the namespace impacts in various contexts, particularly in relation to ordering in NMTs. Consequently, the encoding and decoding of the namespace play a crucial role when transmitting data.
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.
AFAIK https://en.wikipedia.org/wiki/Endianness is important to clarify for types like a int64
but I don't understand how it applies to this []byte
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.
You can use the encoding/binary packages in the Go std to read or write multi-byte values from byte slices either in big endian or little endian format.
Exactly, as soon as we want to read and use that byte slice, then the endianness becomes important. Imagine a namespace query with a namespace encoded in little-endian order (in its Protobuf format), while the receiver expects namespaces in big-endian order, so the query won't be resolved correctly, as there won't be any match in the tree for that namespace due to the mismatch endianness.
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.
LGTM
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 for improving the namespace specs!
Overview
I have made clarifications and revisions to the namespace specifications in the PR as part of my effort to audit the namespace module. Additionally, I have included inline questions primarily intended for the spec owner. Once these questions are resolved, I will promptly take the necessary actions accordingly.
This PR also adheres to semantic line breaks and also makes wording updates according to RFC 2119.
Checklist