Skip to content
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

TIP-23 Tagged Data Payload #54

Merged
merged 5 commits into from
Jul 13, 2022
Merged

TIP-23 Tagged Data Payload #54

merged 5 commits into from
Jul 13, 2022

Conversation

Wollac
Copy link
Contributor

@Wollac Wollac commented Jan 24, 2022

This PR creates a new TIP containing the Tagged Data Payload.
It supersedes #50

Rendered Version

tips/TIP-0023/tip-0023.md Outdated Show resolved Hide resolved
| Payload Type | uint32 | Set to *value 5* to denote an _Tagged Data Payload_. |
| Tag Length | uint8 | The length of the following tag field in bytes. |
| Tag | ByteArray[Tag Length] | The tag of the data. |
| Data | ByteArray | Binary data. |
Copy link

@oopsmonk oopsmonk Feb 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do we know the length of the arbitrary data, shouldn't have a Data Length field?
Is max data length depend on parent number and tag length?

the Tagged Data Payload must consume the entire byte array of the Payload field of the encapsulating object.

Could you elaborate more about this sentence?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ByteArray serialization primitive is described here: https://github.com/Wollac/protocol-rfcs/blob/serialization/tips/TIP-0021/tip-0021.md
In short, it has a leading uint32 to denote its length

the Tagged Data Payload must consume the entire byte array of the Payload field of the encapsulating object.

All this means is that there can not be trailing bytes in the Payload. So the Tagged Data Payload with all its fields fits into Payload Length of the message

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to TIP-18, all ByteArray paired with a length field in structures. for instance State Metadata has State Metadata Length in the Alias output. serialization of State Metadata would be uint16 + uint32 + data bytes which is not correct.
the definition of ByteArray in TIP-21 is not true since the length limitation of ByteArray is vary depends on the object.

@alexsporn
Copy link
Member

@lzpap we currently allow payloads with empty tag and empty data. Is this correct?

@lzpap
Copy link
Member

lzpap commented Apr 4, 2022

@lzpap we currently allow payloads with empty tag and empty data. Is this correct?

For the indexation payload we allowed empty data, but not empty tag becasue you needed something to index with. Now that we don't do indexing with the Tagged Data Payload, we don't need to enforce the tag IMO.

I see value in having empty payload, for example if you just want to issue messages to help confirmation, but you want to do the absolute minimum PoW for the msg.

What do you think @alexsporn?

@Thoralf-M
Copy link
Member

@lzpap for absolute minimum PoW one would just use no payload

@lzpap
Copy link
Member

lzpap commented Apr 4, 2022

@lzpap for absolute minimum PoW one would just use no payload

yes, you are right. The oneOf keyword mislead me in the msg structure, it should be rather optOneOf.
image

@lzpap lzpap merged commit 25382ab into iotaledger:main Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants