-
Notifications
You must be signed in to change notification settings - Fork 50
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
RFC: Tangle Message #17
Conversation
text/0017-message/0017-message.md
Outdated
So the varint `0x0F` equals to `0x8F8000`, but is encoded with different bytes. | ||
* *Size Protection*: The varint must not be more than 10 bytes long. A 10 byte varint can encompass all the range of `uint64`. In case of an overflow above the `uint64` range the message is invalid. | ||
2. When we are done parsing the message there shouldn't be any trailing bytes left that were not parsed. | ||
4. If the `payload type` is in the core payload range (0-127) and the node is familiar with it, or if it is in the range of 128-16383. The upper limit of 16383 is the maximal value of a 2 byte varint, and it should suffice for all the optional payload types we need. |
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.
How do you register a custom (community) payload type?
Is 16383 sufficient for all applications?
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.
IIRC, in our meetings we threw ideas on how it might be.
I think one idea was that community member will also create RFCs but not sure this is the best way to approach this
I think that together with community volunteers we should define at least one community payload. Then we should properly document and implement it, so other community members can easily follow.
We should probably talk about it more in a meeting.
Regarding the 16,383 (2^14 - 1) limit, I just thought it was a high enough number...
Given that we support colored coins it is hard for me to imagine that the payload feature will become so popular that this limit won't suffice...
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.
We should really explain how we envision this community-driven payload draft process.
I guess we want to have a table somewhere where people can create a PR with a new ID and link to the document / RFC describing the payload.
Does it maybe make more sense to have a separate RFC with this table (similar to SLIP-44 or SLIP-173)? That could make the process considerably easier.
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.
Why use a varint if you have a max bound of 2 bytes? It is way easier to define a uint16 here
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.
See my other answer
Also Wolfgang seems to not like this bound, so maybe this bound will be removed (still need to discuss this with him)
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.
I think the bound (for the non-core payloads) seems arbitrary and should be removed. We should allow for the full uint32 maybe even uint64 space.
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.
I agree the message length protection suffices.
Actually, while thinking about the case for the bound, I started to question whether the message length is really needed...
text/0017-message/0017-message.md
Outdated
So the varint `0x0F` equals to `0x8F8000`, but is encoded with different bytes. | ||
* *Size Protection*: The varint must not be more than 10 bytes long. A 10 byte varint can encompass all the range of `uint64`. In case of an overflow above the `uint64` range the message is invalid. | ||
2. When we are done parsing the message there shouldn't be any trailing bytes left that were not parsed. | ||
4. If the `payload type` is in the core payload range (0-127) and the node is familiar with it, or if it is in the range of 128-16383. The upper limit of 16383 is the maximal value of a 2 byte varint, and it should suffice for all the optional payload types we need. |
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.
We should really explain how we envision this community-driven payload draft process.
I guess we want to have a table somewhere where people can create a PR with a new ID and link to the document / RFC describing the payload.
Does it maybe make more sense to have a separate RFC with this table (similar to SLIP-44 or SLIP-173)? That could make the process considerably easier.
text/0017-message/0017-message.md
Outdated
</tr> | ||
<tr> | ||
<td>Payload Length</td> | ||
<td>varint</td> |
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.
What do we gain by using a varint here? Are you planning to have megabyte-sized messages? Make it a uint32 and reduce complexity instead of making even the header of the message variable in size
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.
We wanted to not have too many types in the message.
The idea is that less types means more simple descriptions and code.
Also, for lots of cases where we describe quantities uint8
or uint16
could have sufficed.
So the idea is that choosing varints will result mostly in shorter messages
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.
I'm not convinced it will be simpler code. It's not native primitive in many languages.
So we either implement one ourselves or use the existing one. Both would end up with more validation rules.
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.
If uint8_t
or uint16_t
is sufficed, why not just use one of them? they are primitive types in most languages. The varint
is good for data serialization but it is not easy to operate and memory management in a data structure, especially for microcontrollers.
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.
due to recent conversations outside of github I am also leaning towards dropping varints
this decision will be finalized on the next protocol team meeting
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.
TL;DR: I would rather set fixed reasonable-sized types with some slack (you never know) replacing most varints.
varints
are somewhat complex types to parse, but I would like to draw your attention to the creation of such message rather than the parsing of it. varints
type force the entire message structure to "shift" instead of having fixed offsets. This is quite cumbersome when forming a message where all the parts are not necessarily known before-hand, and therefore the byte-requirements of length varint
types is also unknown: when you fill in the data section of the message, you may see yourself push it forward in order to accommodate the corresponding varint
size without overflowing into the data section itself. Sure, modern programming languages and libs provide abstract structures for all these, but at a cost of memory reallocation, memory concatenation and other forms of memory juggling. Leveling the participation field ultimately accounts for the flexibility of a solution.
text/0017-message/0017-message.md
Outdated
|
||
### Message PoW Hash | ||
|
||
This hash is computed by converting all the messages raw bytes into trytes with `b1t6`. Then hash the result with Curl-P-81. The result will be used to verify the proof-of-work done on the message. This will be used for spam protection. |
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.
We usually put the t
before the b
, so t6b1
.
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.
Also, trits, not trytes.
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.
I think this is fundamentally different:
t5b1
encodes ternary data into binary, by converting each group of 5 trits into one byte; it cannot decode arbitrary binary datab1t6
encodes binary data into ternary, by converting each byte into 6 trits; it cannot decode arbitrary ternary data
In RFC-15 it is also called b1t6
.
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.
I think maybe I can delete this entire section. Now we have an RFC dedicated for computing this PoW hash
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, the entire section should be deleted. See #17 (comment)
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.
due to me looking at the RFC while you are commenting I repeated your remarks :-P
Co-authored-by: Thibault Martinez <thibault.martinez.30@gmail.com>
Co-authored-by: Thibault Martinez <thibault.martinez.30@gmail.com>
awesome. thanks everyone! |
Parent mesage ids need to be ordered and unique |
text/0017-message/0017-message.md
Outdated
|
||
# Summary | ||
|
||
A message is the object nodes gossip around in the network. It always references two other messages that are known as _parents_. It is stored as a vertex on the tangle data structure that the nodes maintain. |
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.
It always references two other messages that are known as parents.
Not factually correct
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.
Yep, good catch. I'll go over the entire text and make sure that everything is correct.
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.
@thibault-martinez I did a mayor rewrite of the RFC that should hopefully address all the outstanding issues. Please consider reviewing again.
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.
- Parents are not sorted
- Example message is invalid as it contains the parents in the wrong order
Rendered