Skip to content

Commit

Permalink
Update Metadata Feature
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter committed Nov 10, 2023
1 parent 1dfb036 commit e7ed6a2
Showing 1 changed file with 44 additions and 9 deletions.
53 changes: 44 additions & 9 deletions tips/TIP-0038/tip-0038.md
Original file line number Diff line number Diff line change
Expand Up @@ -800,13 +800,9 @@ protocol treats this metadata as pure binary data, it has no effect on the valid
increases the required storage deposit. ISC is a great example of a higher-layer protocol that makes use of <i>Metadata
Feature</i>: smart contract request parameters are encoded in the metadata field of outputs.

#### Additional syntactic transaction validation rules:

- An output with <i>Metadata Feature</i> is valid, if and only if 0 < `length(Data)``Max Metadata Length`.

<details>
<summary>Metadata Feature</summary>
<blockquote>Defines metadata (arbitrary binary data) that will be stored in the output.</blockquote>
<blockquote>Defines a map of key-value pairs that is stored in the output.</blockquote>
</details>
<table>
<tr>
Expand All @@ -826,12 +822,51 @@ Feature</i>: smart contract request parameters are encoded in the metadata field
<td>Set to <strong>value 2</strong> to denote a <i>Metadata Feature</i>.</td>
</tr>
<tr>
<td>Data</td>
<td>(uint16)ByteArray</td>
<td>Binary data. A leading uint16 denotes its length.</td>
<td>Entries Count</td>
<td>uint8</td>
<td>The number of entries in the map.</td>
</tr>
<tr>
<td valign="top">Entries <code>anyOf</code></td>
<td colspan="2">
<details>
<summary>Metadata Entry</summary>
<blockquote>A map entry consisting of a string key and an arbitrary byte value.</blockquote>
<table>
<tr>
<td>
<b>Name</b>
</td>
<td>
<b>Type</b>
</td>
<td>
<b>Description</b>
</td>
</tr>
<tr>
<td>Key</td>
<td>(uint8)ByteArray</td>
<td>A string which may only consist of ASCII characters. A leading uint8 denotes its length.</td>
</tr>
<tr>
<td>Value</td>
<td>(uint16)ByteArray</td>
<td>An array of arbitrary binary data. A leading uint16 denotes its length.</td>
</tr>
</table>
</details>
</td>
</tr>
</table>

#### Additional syntactic transaction validation rules:

- Each `Key` in the `Entries` must consist only of bytes that are valid ASCII characters, that is, each byte may not
exceed `127`.
- `Entries Count` must be at least `1`.
- The serialized size of the feature may not exceed `8192` bytes.

### Tag Feature

A <i>Tag Feature</i> makes it possible to tag outputs with an index, so they can be retrieved through an indexer API not
Expand Down Expand Up @@ -901,7 +936,7 @@ plugin.
<tr>
<td>Token ID</td>
<td>ByteArray[38]</td>
<td>Identifier of the native token. Its derivation is defined in <a href='../TIP-0044/tip-0044.md#foundry-output'>TIP-44</a>.</td>
<td>Identifier of the native token. Its derivation is defined in <a href='../TIP-0044/tip-0044.md#foundry-output'>TIP-44 (Foundry Output)</a>.</td>
</tr>
<tr>
<td>Amount</td>
Expand Down

0 comments on commit e7ed6a2

Please sign in to comment.