-
Notifications
You must be signed in to change notification settings - Fork 24
Messages Pallet Documentation Improvement #1981
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5bc3d74
Messages Pallet Readme docs
wilwade e314c64
Merge branch 'main' into docs/messages
wilwade b934bc0
Apply suggestions from code review
wilwade dcfb961
Apply suggestions from code review
wilwade 5e57ffc
Update pallets/messages/src/lib.rs
wilwade 28fe6f9
Review feedback
wilwade ac79f5d
Merge remote-tracking branch 'origin/main' into docs/messages
wilwade 2bbd0d9
Merge branch 'main' into docs/messages
wilwade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Messages Pallet | ||
|
|
||
| Stores block-indexed data for a Schema using `OnChain` or `IPFS` payload location. | ||
|
|
||
| ## Summary | ||
|
|
||
| Messages stores metadata and message payload data for a set Schema. | ||
| Message payloads are meant for streaming data, where when the message was sent is the focus. | ||
| Discovery is via the `MessagesInBlock` on new blocks or requesting messages from a block. | ||
| Retrieval is via RPC. | ||
|
|
||
| ### Metadata vs Payload | ||
|
|
||
| Messages have both metadata and payloads. | ||
| The payload should always match the data structure or the message is considered invalid. | ||
| The metadata is the Block Number, Schema Id, and other data useful for discovering and organizing the payload information. | ||
|
|
||
| ### Payload Options | ||
|
|
||
| - `IPFS`: Storage of the CID and length of the file on IPFS | ||
| - `OnChain`: Storage of the entire payload data, usually for sub-256 byte payloads | ||
|
|
||
| ### Message Ordering | ||
|
|
||
| Messages are ordered by block number, and within each block, they follow a specific order based on their transaction sequence within that block. | ||
| This order is immutable. | ||
|
|
||
| ### Actions | ||
|
|
||
| The Messages pallet provides for: | ||
|
|
||
| - Adding messages for a given schema | ||
wilwade marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - Enabling the retrieval of messages for a given schema | ||
|
|
||
| ## Interactions | ||
|
|
||
| ### Extrinsics | ||
|
|
||
| | Name/Description | Caller | Payment | Key Events | Runtime Added | | ||
| | ---------------------------------------------------------------------------------------- | -------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------- | ------------- | | ||
| | `add_ipfs_message`<br />Add a message to a Schema with an `IPFS` payload location | Provider | Capacity or Tokens | [`MessagesInBlock`](https://frequency-chain.github.io/frequency/pallet_messages/pallet/enum.Event.html#variant.MessagesInBlock)\* | 1 | | ||
| | `add_onchain_message`<br />Add a message to a Schema with an `ON_CHAIN` payload location | Provider | Capacity or Tokens | [`MessagesInBlock`](https://frequency-chain.github.io/frequency/pallet_messages/pallet/enum.Event.html#variant.MessagesInBlock)\* | 1 | | ||
|
|
||
| \* The `MessagesInBlock` may not occur more than once per block and does _not_ indicate which schema received messages. | ||
|
|
||
| See [Rust Docs](https://frequency-chain.github.io/frequency/pallet_messages/pallet/struct.Pallet.html) for more details. | ||
|
|
||
| ### State Queries | ||
|
|
||
| | Name | Description | Query | Runtime Added | | ||
| | --------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------- | | ||
| | Get Messages v2 | _Suggested_: Use RPC instead of this storage directly. Storage for the messages by Block number, Schema Id, and Message Index | `messagesV2` | 61 | | ||
| | Get Messages v1 | Removed in Runtime 60 | `messages` | 1-60 | | ||
|
|
||
| See the [Rust Docs](https://frequency-chain.github.io/frequency/pallet_messages/pallet/storage_types/index.html) for additional state queries and details. | ||
|
|
||
| ### RPCs | ||
|
|
||
| Note: May be restricted based on node settings and configuration. | ||
|
|
||
| | Name | Description | Call | Node Version | | ||
| | ------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | | ||
| | Get Messages by Schema Id | Fetch paginated messages for a specific Schema Id in the given block range for a given Schema Id | [`getBySchemaId`](https://frequency-chain.github.io/frequency/pallet_messages_rpc/trait.MessagesApiServer.html#tymethod.get_messages_by_schema_id) | v1.0.0+ | | ||
|
|
||
| See [Rust Docs](https://frequency-chain.github.io/frequency/pallet_messages_rpc/trait.MessagesApiServer.html) for more details. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.