Skip to content

feat: Describe encoding and composition of assets in docs#2956

Merged
PhilippGackstatter merged 7 commits into
nextfrom
pgackst-asset-composition-docs
May 22, 2026
Merged

feat: Describe encoding and composition of assets in docs#2956
PhilippGackstatter merged 7 commits into
nextfrom
pgackst-asset-composition-docs

Conversation

@PhilippGackstatter
Copy link
Copy Markdown
Contributor

Follows up on #2942 (comment) to describe asset composition in more detail. As a byproduct, it was useful to describe the encoding of assets, which may supersede #2867, cc @BrianSeong99.

@PhilippGackstatter PhilippGackstatter added the pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority label May 20, 2026
@PhilippGackstatter PhilippGackstatter added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label May 20, 2026
Comment thread docs/src/asset.md Outdated
Comment thread docs/src/asset.md Outdated
Comment thread docs/src/asset.md Outdated
Comment thread docs/src/asset.md Outdated
Comment thread docs/src/asset.md Outdated
Comment thread docs/src/asset.md
Comment thread docs/src/asset.md
Comment on lines +51 to +58
```text
[
asset_id_suffix (64 bits),
asset_id_prefix (64 bits),
[faucet_id_suffix (56 bits) | reserved (5 bits) | callback_flag (1 bit) | composition (2 bits)],
faucet_id_prefix (64 bits)
]
```
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If two assets have the same asset ID and faucet ID but perhaps different callback flags or composition bits, they are just treated as fully different assets, right? Or is there any problem when dealing with them in the same context?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If two assets have the same asset ID and faucet ID but perhaps different callback flags or composition bits, they are just treated as fully different assets, right?

Yes, fully different. So the rule

Two assets are of the same type whenever their vault keys match.

fully applies, including the composition and callback flag.

It wouldn't be clear how to merge/split an asset whose key matches except for the composition bit. Similarly, it wouldn't be clear how to merge callback-enabled and callback-disabled asset - what would be the flag for the merged asset?

Copy link
Copy Markdown
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

Comment thread docs/src/asset.md Outdated
Comment thread docs/src/asset.md Outdated
Comment thread docs/src/asset.md
- `asset_id_suffix` and `asset_id_prefix` is and ID that determines if two assets issued by the same faucet are considered to be the same asset. It is set by the asset creator arbitrarily - see [identity](#identity) for more.
- `callback_flag` is the flag that determines whether callbacks are enabled (see also [callbacks](#callbacks)).
- `composition` describes how assets compose. Read on for more details.
- `reserved` bits are reserved for future use and should be assumed to be undefined and therefore not relied upon.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we not enforce these to be zeros?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We do, but this is about warning users not to rely on these being zero. If someone writes code to deal with assets and assumes these are zero, and we start using these bits in the future, that code might break.

That's why I added the "should not be relied upon" sentence here.

@PhilippGackstatter PhilippGackstatter added this pull request to the merge queue May 22, 2026
Merged via the queue into next with commit ea66d5f May 22, 2026
21 checks passed
@PhilippGackstatter PhilippGackstatter deleted the pgackst-asset-composition-docs branch May 22, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants