-
Notifications
You must be signed in to change notification settings - Fork 74
Create XCM Observability Guide (#873) #980
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
base: master
Are you sure you want to change the base?
Conversation
Pulling in external contributions for formatting review. * Copy XCM Observability * Apply the new format * Update Induction * Update Prerequisites * Update Where to Go Next * Add Understanding the Basics * Add scripts * Add result * Update Failure Event Handling * Add forwardIdFor * Update Workaround for Older Runtimes * Update Where to Go Next * Update Prerequisites * Remove Where to Go Next * Reorder the content * Change to Hydration * Update script * Update script * Check if PolkadotXcm.Sent exists * Add Define a Scenario: Multi-Hop XCM with Manual `SetTopic` * Add multi-hop-with-set-topic.ts * Add results * Update the order * Check grammar * Update Prerequisites * Update scripts * Add Set Up Your Project * Update script name * Update header * Update limited-reserve-transfer-assets.ts * Update scripts * Update deposit-reserve-asset-with-set-topic.ts * Update initiate-reserve-withdraw-with-set-topic.ts * Add forwarded-xcm-remote-topic.html * Update XCM Transfer with Manual `SetTopic` * Fix typos * Add Multi-hop XCM Transfer with Manual `SetTopic` * Update fully * Update partially * Update flowchart * Update flowchart * Update flowchart * Break into two lines * Break into two lines * Use TD * Update flowchart * Update limited_reserve_transfer_assets * Update DepositReserveAsset * Update InitiateReserveWithdraw * Update scripts * Update MAX_RETRIES * Fix fmt * Fix fmt * Update Prerequisites * Update to Polkadot Hub * Update to Polkadot Hub * Add Observability Features * Update wordings * Update Observability Features * Update Automatic vs Manual `SetTopic` * Update Summary * Fix output files * Change the exchange rate * Fix conflicts * Fix conflicts * Revert changes * Revert changes * Revert changes * Revert changes * Revert changes * Revert changes * Revert changes * Change Setting Up Your Workspace * Add links to Rust docs * Update limited-reserve-transfer-assets.ts * Update deposit-reserve-asset-with-set-topic.ts * Update initiate-reserve-withdraw-with-set-topic.ts * Fix imports * Fix typos * Add Troubleshooting on Running Scripts * Revert unrelated changes * Revert unrelated changes * Use 1.6.0 or later * Fix merge conflicts * Update tutorials/interoperability/xcm-observability.md Co-authored-by: Nicolás Hussein <80422357+nhussein11@users.noreply.github.com> * Add XCM Observability in Action * Update XCM Observability in Action * Update XCM Observability * Fix execution-with-error.html * Move Workaround for Older Runtimes * Use blake2b instead of blake2AsU8a * Use blake2b instead of blake2AsU8a * Add WithUniqueTopic * Add on system chains * Add on system chains --------- Co-authored-by: Nicolás Hussein <80422357+nhussein11@users.noreply.github.com>
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.
Pull Request Overview
This PR creates comprehensive documentation for XCM observability capabilities in Polkadot, providing both conceptual understanding and hands-on guidance. The addition introduces tracing, correlation, and debugging features for cross-chain messages through SetTopic instructions and message ID tracking.
- Adds conceptual documentation explaining XCM observability features in modern runtimes
- Creates a practical tutorial with three scenarios demonstrating message tracing techniques
- Provides troubleshooting guidance and code examples for implementing observability workflows
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tutorials/interoperability/xcm-observability-in-action.md | Complete hands-on tutorial with three XCM scenarios and troubleshooting |
| develop/interoperability/xcm-observability.md | Conceptual overview of XCM observability features and best practices |
| tutorials/interoperability/.nav.yml | Navigation update to include new tutorial |
| develop/interoperability/.nav.yml | Navigation update to include new concept page |
| llms.txt & llms-full.txt | Documentation index updates for AI systems |
| .snippets/code/* | TypeScript code examples and HTML output samples |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| > ⚠️ PolkadotXcm.Sent is only available in runtimes built from stable2503-5 or later. | ||
|
|
||
| This error usually means that your runtime needs to be updated. Ensure that `wasm-override` is updated to runtime version 1.6.0+, or to any runtime built from `stable2503-5` or later. | ||
|
|
Copilot
AI
Sep 15, 2025
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.
The error handling section references updating the wasm-override but doesn't explain how to do this. Consider adding a brief instruction or linking to more detailed update procedures.
| To update your `wasm-override`, download the latest runtime `.wasm` file for your chain and specify its path using the `--wasm-override` flag in your Chopsticks command or configuration. For a step-by-step guide, see [How to Override the Runtime Wasm](https://github.com/paritytech/chopsticks#runtime-wasm-override){target=_blank}. |
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.
@nhussein11 thoughts on this suggestion? I don't know if it's needed??
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 won't work. It requires to change the config file: wasm-override: wasms/asset-hub-polkadot_v1.6.0.wasm.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
eshaben
left a 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.
I think we can make the material easier to digest.
The tutorial doesn't feel like a tutorial right now. It mostly has example code without context, which makes it feel more like a reference than a learning experience.
The guide needs to be more clear in the way we're laying out the information. In it's current format, it's not the easiest to read, so I left some comments on how we can improve this.
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.
This file needs to be formatted, please
| @@ -0,0 +1,10 @@ | |||
| <div class="termynal" data-termynal> | |||
| <span data-ty="input">npx tsx limited-reserve-transfer-assets.ts</span> | |||
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.
This is missing the file path span
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.
Please format
| } from "@polkadot-labs/hdkd-helpers"; | ||
|
|
||
| const XCM_VERSION = 5; | ||
| const MAX_RETRIES = 8; // Number of attempts to wait for block finalisation |
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.
| const MAX_RETRIES = 8; // Number of attempts to wait for block finalisation | |
| const MAX_RETRIES = 8; // Number of attempts to wait for block finalization |
|
|
||
| ### Forwarded XCM Example | ||
|
|
||
| The following example illustrates the runtime adding a `SetTopic` to the forwarded XCM automatically: |
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.
@nhussein11 @brunopgalvao Is this section helpful? Like what produces the output in the terminal?
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.
This goes for all the Forwarded XCM Example sections. I'm confused by them
|
|
||
| When an XCM fails, the transaction rolls back and no explicit failure event is emitted on-chain. The following are some ways to check for XCM failure: | ||
|
|
||
| 1. **View nested dispatch errors via indexers**: Most indexers display nested errors indicating why an XCM failed, e.g.: |
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.
| 1. **View nested dispatch errors via indexers**: Most indexers display nested errors indicating why an XCM failed, e.g.: | |
| 1. **View nested dispatch errors via indexers**: Most indexers display nested errors indicating why an XCM failed. For example: |
|
|
||
| Common errors include missing assets, exceeded execution limits, or invalid asset locations. This nested error reporting, introduced in runtimes from `stable2506` onward, usually suffices to diagnose typical issues. | ||
|
|
||
| 2. **Replay using Chopsticks for full logs**: For detailed troubleshooting, try the following steps: |
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.
Should this even be a set of steps? These are two totally different things that don't seem sequential. Probably should be an unordered list instead.
| - See exactly which instruction failed and why. | ||
| - View complete error chains like `FailedToTransactAsset` or `AssetNotFound`. | ||
|
|
||
| This approach is invaluable for multi-hop flows and complex custom XCMs. |
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.
This seems unnecessary unless we're going to explain why.
| 1. Start with indexer or API error output. | ||
| 2. If unclear, use Chopsticks to replay the exact transaction. |
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.
Repetitive of steps above. Maybe we should consider the order of these sections. Makes more sense to briefly introduce then do a deeper dive than to do a deep dive and then mention it again
| !!! note | ||
| When using [`WithUniqueTopic`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm_builder/struct.WithUniqueTopic.html){target=\_blank}, the topic ID is guaranteed to be unique if `WithUniqueTopic` automatically appends the `SetTopic` instruction. However, if the message already includes a `SetTopic` instruction, the uniqueness of the ID depends on the message creator and is not guaranteed. | ||
|
|
||
| ## Observability Features |
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 really a fan of this section. Like we introduce PolkadotXcm.Sent and MessageQueue.Porcessed in the list then we have a table. I feel like why are we providing some info in a list and some of it in a table? Actually makes it harder to read because you have to piece it together.
|
@raymondkfcheung I truly appreciate this contribution! We're currently undertaking a major migration to a new documentation architecture. For this reason, I'm going to hold off on merging this PR for now. Once the XCM content is settled in the new structure, we will use your work to ensure it aligns with our updated, user-journey-focused guide standards. Thank you for your patience and excellent contribution! |
| ```yaml title="configs/polkadot-hub-override.yaml" | ||
| ... | ||
| db: ./db.sqlite | ||
| wasm-override: wasms/asset-hub-polkadot_v1.6.0.wasm |
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.
Applies formatting suggestions to content contributed for XCM Observability (concept page and tutorial). @nhussein11 please take another look to make the suggested changes in language don't break the technical accuracy of the information. Would you also please see if you can add a little more in the places where there are long scripts? Like more comments explaining what's happening or a summary at the end of the snippet like "This code does the following...." or something. This feels complete but kind of abrupt and not super smooth if that makes sense.