From 9ed7bbc532f561a04476aa63ffb351b7ec539e1a Mon Sep 17 00:00:00 2001 From: Raymond Cheung <178801527+raymondkfcheung@users.noreply.github.com> Date: Tue, 16 Sep 2025 00:59:08 +0800 Subject: [PATCH 1/6] Create XCM Observability Guide (#873) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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> --- .../execution-with-error.html | 19 + .../xcm-observability/forward-id-for.ts | 32 + ...t-reserve-asset-with-set-topic-result.html | 10 + .../deposit-reserve-asset-with-set-topic.ts | 236 +++ .../forwarded-xcm-custom-topic.html | 25 + .../forwarded-xcm-remote-topic.html | 46 + .../forwarded-xcm.html | 25 + ...eserve-withdraw-with-set-topic-result.html | 13 + ...nitiate-reserve-withdraw-with-set-topic.ts | 291 ++++ ...imited-reserve-transfer-assets-result.html | 9 + .../limited-reserve-transfer-assets.ts | 186 +++ develop/interoperability/xcm-observability.md | 149 ++ llms-full.txt | 1285 +++++++++++++++++ llms.txt | 4 +- tutorials/interoperability/.nav.yml | 1 + .../xcm-observability-in-action.md | 245 ++++ 16 files changed, 2575 insertions(+), 1 deletion(-) create mode 100644 .snippets/code/develop/interoperability/xcm-observability/execution-with-error.html create mode 100644 .snippets/code/develop/interoperability/xcm-observability/forward-id-for.ts create mode 100644 .snippets/code/tutorials/interoperability/xcm-observability-in-action/deposit-reserve-asset-with-set-topic-result.html create mode 100644 .snippets/code/tutorials/interoperability/xcm-observability-in-action/deposit-reserve-asset-with-set-topic.ts create mode 100644 .snippets/code/tutorials/interoperability/xcm-observability-in-action/forwarded-xcm-custom-topic.html create mode 100644 .snippets/code/tutorials/interoperability/xcm-observability-in-action/forwarded-xcm-remote-topic.html create mode 100644 .snippets/code/tutorials/interoperability/xcm-observability-in-action/forwarded-xcm.html create mode 100644 .snippets/code/tutorials/interoperability/xcm-observability-in-action/initiate-reserve-withdraw-with-set-topic-result.html create mode 100644 .snippets/code/tutorials/interoperability/xcm-observability-in-action/initiate-reserve-withdraw-with-set-topic.ts create mode 100644 .snippets/code/tutorials/interoperability/xcm-observability-in-action/limited-reserve-transfer-assets-result.html create mode 100644 .snippets/code/tutorials/interoperability/xcm-observability-in-action/limited-reserve-transfer-assets.ts create mode 100644 develop/interoperability/xcm-observability.md create mode 100644 tutorials/interoperability/xcm-observability-in-action.md diff --git a/.snippets/code/develop/interoperability/xcm-observability/execution-with-error.html b/.snippets/code/develop/interoperability/xcm-observability/execution-with-error.html new file mode 100644 index 000000000..e00aef25b --- /dev/null +++ b/.snippets/code/develop/interoperability/xcm-observability/execution-with-error.html @@ -0,0 +1,19 @@ +
+"error": {
+ "type": "Module",
+ "value": {
+ "type": "PolkadotXcm",
+ "value": {
+ "type": "LocalExecutionIncompleteWithError",
+ "value": {
+ "index": 0,
+ "error": {
+ "type": "FailedToTransactAsset"
+ }
+ }
+ }
+ }
+}
+
+
+[
+ {
+ "type": "ReserveAssetDeposited",
+ "value": [...]
+ },
+ {
+ "type": "ClearOrigin"
+ },
+ {
+ "type": "BuyExecution",
+ "value": {...}
+ },
+ {
+ "type": "DepositAsset",
+ "value": {...}
+ },
+ {
+ "type": "SetTopic",
+ "value": "0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2"
+ }
+]
+
+
+[
+ {
+ "type": "ReserveAssetDeposited",
+ "value": [...]
+ },
+ {
+ "type": "ClearOrigin"
+ },
+ {
+ "type": "BuyExecution",
+ "value": {...}
+ },
+ {
+ "type": "ExchangeAsset",
+ "value": {...}
+ },
+ {
+ "type": "InitiateReserveWithdraw",
+ "value": {
+ "assets": {...},
+ "reserve": {...},
+ "xcm": [
+ {
+ "type": "BuyExecution",
+ "value": {...}
+ },
+ {
+ "type": "DepositAsset",
+ "value": {...}
+ },
+ {
+ "type": "SetTopic",
+ "value": "0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2"
+ }
+ ]
+ }
+ },
+ {
+ "type": "SetTopic",
+ "value": "0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2"
+ }
+]
+
+
+[
+ {
+ "type": "ReserveAssetDeposited",
+ "value": [...]
+ },
+ {
+ "type": "ClearOrigin"
+ },
+ {
+ "type": "BuyExecution",
+ "value": {...}
+ },
+ {
+ "type": "DepositAsset",
+ "value": {...}
+ },
+ {
+ "type": "SetTopic",
+ "value": "0x3b5650b78230aebb8f2573d2c5e8356494ab01e39e716087c177bf871dce70b9"
+ }
+]
+
+
+"error": {
+ "type": "Module",
+ "value": {
+ "type": "PolkadotXcm",
+ "value": {
+ "type": "LocalExecutionIncompleteWithError",
+ "value": {
+ "index": 0,
+ "error": {
+ "type": "FailedToTransactAsset"
+ }
+ }
+ }
+ }
+}
+
+
+[
+ {
+ "type": "ReserveAssetDeposited",
+ "value": [...]
+ },
+ {
+ "type": "ClearOrigin"
+ },
+ {
+ "type": "BuyExecution",
+ "value": {...}
+ },
+ {
+ "type": "DepositAsset",
+ "value": {...}
+ },
+ {
+ "type": "SetTopic",
+ "value": "0x3b5650b78230aebb8f2573d2c5e8356494ab01e39e716087c177bf871dce70b9"
+ }
+]
+
+
+[
+ {
+ "type": "ReserveAssetDeposited",
+ "value": [...]
+ },
+ {
+ "type": "ClearOrigin"
+ },
+ {
+ "type": "BuyExecution",
+ "value": {...}
+ },
+ {
+ "type": "DepositAsset",
+ "value": {...}
+ },
+ {
+ "type": "SetTopic",
+ "value": "0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2"
+ }
+]
+
+
+[
+ {
+ "type": "ReserveAssetDeposited",
+ "value": [...]
+ },
+ {
+ "type": "ClearOrigin"
+ },
+ {
+ "type": "BuyExecution",
+ "value": {...}
+ },
+ {
+ "type": "ExchangeAsset",
+ "value": {...}
+ },
+ {
+ "type": "InitiateReserveWithdraw",
+ "value": {
+ "assets": {...},
+ "reserve": {...},
+ "xcm": [
+ {
+ "type": "BuyExecution",
+ "value": {...}
+ },
+ {
+ "type": "DepositAsset",
+ "value": {...}
+ },
+ {
+ "type": "SetTopic",
+ "value": "0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2"
+ }
+ ]
+ }
+ },
+ {
+ "type": "SetTopic",
+ "value": "0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2"
+ }
+]
+
+@@ -3331,33 +3319,34 @@ When an XCM fails, the transaction **rolls back** and no explicit failure event
@@ -31420,35 +31422,24 @@ The runtime adds a `SetTopic` to the forwarded XCM automatically: | Polkadot Hub | `PolkadotXcm.Sent` | `message_id` | Matches the topic in the forwarded XCM | | Hydration | `MessageQueue.Processed` | `id` | Matches origin's `message_id` | -> β οΈ Dry run generated topics may differ from actual execution. - -### Message Trace Output - -- npx tsx limited-reserve-transfer-assets.ts - β Local dry run successful. - π¦ Finalised on Polkadot Hub in block #9477291: 0xf54cecc017762c714bbdf3e82d72ed90886257ca17d32ec6dc8ea20e28110af8 - π£ Last message sent on Polkadot Hub: 0x20432393771dc049cea4900565a936d169b8ebdd64efa351890766df918615a4 - π¦ Finalised on Hydration in block #8761211: 0xa4c493ba9328f38174aa7a9ade0779654839e9d3c83b2bafc60d4e5b7de6a00f - π£ Last message processed on Hydration: 0x20432393771dc049cea4900565a936d169b8ebdd64efa351890766df918615a4 - β Processed Message ID on Hydration matched. -+!!! note + Dry run-generated topics may differ from actual execution. -## Scenario 2: XCM Transfer with Manual `SetTopic` +## XCM Flow with Manual `SetTopic` -### Overview +Assume the following values for this scenario: -- **Origin:** Polkadot Hub -- **Destination:** Hydration -- **Topic:** Manually assigned -- **Goal:** Ensure traceability in custom multi-hop flows +- **Origin**: Polkadot Hub +- **Destination**: Hydration +- **Topic**: Manually assigned +- **Goal**: Ensure traceability in custom multi-hop flows -### Run the Script +Follow these steps to complete the manual `SetTopic` flow: -Create and run `deposit-reserve-asset-with-set-topic.ts`: +1. Create a new file named `deposit-reserve-asset-with-set-topic.ts` and add the following code: -```ts -import {Binary, createClient, Enum, type BlockInfo, type PolkadotClient} from "polkadot-api"; + ```ts + import {Binary, createClient, Enum, type BlockInfo, type PolkadotClient} from "polkadot-api"; import {withPolkadotSdkCompat} from "polkadot-api/polkadot-sdk-compat"; import {getPolkadotSigner} from "polkadot-api/signer"; import {getWsProvider} from "polkadot-api/ws-provider/web"; @@ -31684,15 +31675,30 @@ async function main() { } main().catch(console.error); -``` + ``` -```bash -npx tsx deposit-reserve-asset-with-set-topic.ts -``` +2. Run your script with the following command: + + ```bash + npx tsx deposit-reserve-asset-with-set-topic.ts + ``` + +3. You will see terminal output similar to the following: + ++ npx tsx limited-reserve-transfer-assets.ts + β Local dry run successful. + π¦ Finalised on Polkadot Hub in block #9471830: 0x98bd858739b3b5dd558def60cbd85d5e7fb2f4e33b0c00e1895e316541d727d9 + π£ Last message sent on Polkadot Hub: 0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2 + β Sent Message ID on Polkadot Hub matched. + π¦ Finalised on Hydration in block #8749233: 0xe1413c5126698d7189d6f55a38e62d07ea4915078c2b1f3914d70f670e79e162 + π£ Last message processed on Hydration: 0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2 + β Processed Message ID on Hydration matched. +### Forwarded XCM Example -Your manual `SetTopic` is preserved by the runtime: +The following example illustrates that the runtime preserves the manual `SetTopic` value:-### Message Trace Output - -@@ -31720,34 +31726,21 @@ Your manual `SetTopic` is preserved by the runtime:- npx tsx limited-reserve-transfer-assets.ts - β Local dry run successful. - π¦ Finalised on Polkadot Hub in block #9471830: 0x98bd858739b3b5dd558def60cbd85d5e7fb2f4e33b0c00e1895e316541d727d9 - π£ Last message sent on Polkadot Hub: 0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2 - β Sent Message ID on Polkadot Hub matched. - π¦ Finalised on Hydration in block #8749233: 0xe1413c5126698d7189d6f55a38e62d07ea4915078c2b1f3914d70f670e79e162 - π£ Last message processed on Hydration: 0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2 - β Processed Message ID on Hydration matched. -- -## Scenario 3: Multi-hop XCM Transfer with Manual `SetTopic` +## Multi-hop XCM Transfer with Manual `SetTopic` -### Overview +Assume the following values for this scenario: -- **Origin:** Polkadot Hub -- **Destination:** Hydration -- **Topic:** Manually assigned and preserved over multiple hops (including remote XCMs) -- **Goal:** Enable consistent tracing across multi-hop XCM flows +- **Origin**: Polkadot Hub +- **Destination**: Hydration +- **Topic**: Manually assigned and preserved over multiple hops (including remote XCMs) +- **Goal**: Enable consistent tracing across multi-hop XCM flows -### Run the Script +Follow these steps to complete the multi-hop manual `SetTopic` flow: -Create and run `initiate-reserve-withdraw-with-set-topic.ts`: +1. Create a new file named `initiate-reserve-withdraw-with-set-topic.ts` and add the following code: -```ts -import {Binary, createClient, Enum, type BlockInfo, type PolkadotClient} from "polkadot-api"; + ```ts + import {Binary, createClient, Enum, type BlockInfo, type PolkadotClient} from "polkadot-api"; import {withPolkadotSdkCompat} from "polkadot-api/polkadot-sdk-compat"; import {getPolkadotSigner} from "polkadot-api/signer"; import {getWsProvider} from "polkadot-api/ws-provider/web"; @@ -32038,15 +32031,33 @@ async function main() { } main().catch(console.error); -``` + ``` -```bash -npx tsx initiate-reserve-withdraw-with-set-topic.ts -``` +2. Run your script with the following command: + + ```bash + npx tsx initiate-reserve-withdraw-with-set-topic.ts + ``` + +3. You will see terminal output similar to the following. Note, the same `message_id` is present in all relevant events across chains: + ++ npx tsx initiate-reserve-withdraw-with-set-topic.ts + β Local dry run successful. + π¦ Finalised on Polkadot Hub in block #9471831: 0x2620f7e29765fc953263b7835711011616702c9d82ef5306fe3ef4196cb75cab + π£ Last message sent on Polkadot Hub: 0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2 + β Sent Message ID on Polkadot Hub matched. + π¦ Finalised on Hydration in block #8749235: 0xafe7f6149b1773a8d3d229040cda414aafd64baaeffa37fb4a5b2a542308b2d6 + π£ Last message processed on Hydration: 0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2 + β Processed Message ID on Hydration matched. + π¦ Finalised on Polkadot Hub in block #9471832: 0x7c150b69e3562694f0573e4fee73dfb86f3ab71b808679a1777586ff24643e9a + π£ Last message processed on Polkadot Hub: 0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2 + β Processed Message ID on Polkadot Hub matched. +### Forwarded XCM Example (Hydration) -The runtime preserves your `SetTopic` throughout the multi-hop flow: +The following example illustrates how runtime preserves your `SetTopic` throughout the multi-hop flow:-### End-to-End Message Trace Output - -The same `message_id` is present in all relevant events across chains: - -@@ -32095,60 +32106,44 @@ The runtime preserves your `SetTopic` throughout the multi-hop flow:- npx tsx initiate-reserve-withdraw-with-set-topic.ts - β Local dry run successful. - π¦ Finalised on Polkadot Hub in block #9471831: 0x2620f7e29765fc953263b7835711011616702c9d82ef5306fe3ef4196cb75cab - π£ Last message sent on Polkadot Hub: 0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2 - β Sent Message ID on Polkadot Hub matched. - π¦ Finalised on Hydration in block #8749235: 0xafe7f6149b1773a8d3d229040cda414aafd64baaeffa37fb4a5b2a542308b2d6 - π£ Last message processed on Hydration: 0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2 - β Processed Message ID on Hydration matched. - π¦ Finalised on Polkadot Hub in block #9471832: 0x7c150b69e3562694f0573e4fee73dfb86f3ab71b808679a1777586ff24643e9a - π£ Last message processed on Polkadot Hub: 0xd60225f721599cb7c6e23cdf4fab26f205e30cd7eb6b5ccf6637cdc80b2339b2 - β Processed Message ID on Polkadot Hub matched. -- -## Troubleshooting on Running Scripts +## Script Troubleshooting Tips -### Processed Message ID is `undefined` +### Error: "Processed Message ID is `undefined`" -If you see the following error when running a script: +This error usually means that the message has not yet been processed within the default retry window. If you see the following error when running a script: > β Processed Message ID on Hydration is undefined. Try increasing MAX_RETRIES to wait for block finalisation. -This usually means that the message has not yet been processed within the default retry window. - -Increase the `MAX_RETRIES` value in your script to give the chain more time: +Update your script to increase the `MAX_RETRIES` value to give the chain more time: ```ts const MAX_RETRIES = 8; // Number of attempts to wait for block finalisation ``` -### `PolkadotXcm.Sent` Event Not Found +### Error: `PolkadotXcm.Sent` Event Not Found -If you encounter an error indicating that `PolkadotXcm.Sent` is unavailable: +If you encounter an error indicating that `PolkadotXcm.Sent` is unavailable, like the following: > β οΈ PolkadotXcm.Sent is only available in runtimes built from stable2503-5 or later. -Ensure that `wasm-override` is updated to runtime version 1.6.0+, or to any runtime 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. For details on updating your workspace, see [Setting Up Your Workspace](#setting-up-your-workspace). -## Summary +## Conclusion -This guide demonstrated: +Congratulations! By completing this guide, you should now understand: -- How `SetTopic` and `message_id` enable tracing and correlating XCMs across chains -- How to interpret and debug XCM failure cases -- How to manually and automatically manage topics for multi-hop flows -- The legacy workaround for older runtimes with derived IDs +- How `SetTopic` and `message_id` enable tracing and correlating XCMs across chains. +- How to interpret and debug XCM failure cases. +- How to manually and automatically manage topics for multi-hop flows. +- How to use the legacy workaround for older runtimes with derived IDs. With these scenarios and debugging steps, you can confidently develop, trace, and troubleshoot XCM workflows across chains. + +## Additional Resources + +To learn more about XCM Observability features and best practices, see [XCM Observability](/develop/interoperability/xcm-observability){target=\_blank}. --- END CONTENT --- Doc-Content: https://docs.polkadot.com/tutorials/interoperability/xcm-transfers/from-relaychain-to-parachain/ diff --git a/llms.txt b/llms.txt index 4e2a1d7ad..708d07483 100644 --- a/llms.txt +++ b/llms.txt @@ -25,7 +25,7 @@ - [Transact](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-guides/from-apps/transact.md): Learn how to execute arbitrary calls on remote chains using the Transact instruction, enabling cross-chain function execution and remote pallet interactions. - [Transfers](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-guides/from-apps/transfers.md): Learn how to perform cross-chain asset transfers using XCM, including teleport, reserve transfers, and handling different asset types across parachains. - [XCM Guides](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-guides/index.md): Comprehensive guides for implementing XCM functionality in applications and understanding cross-chain interactions. -- [XCM Observability](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-observability.md): A conceptual overview of XCM observability in Polkadot, covering message correlation, tracing, and debugging features in modern runtimes. +- [XCM Observability](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-observability.md): This conceptual overview of XCM observability in Polkadot covers message correlation, tracing, and debugging features in modern runtimes. - [XCM Runtime APIs](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-runtime-apis.md): Learn about XCM Runtime APIs in Polkadot for cross-chain communication. Explore the APIs to simulate and test XCM messages before execution on the network. - [Networks](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/networks.md): Explore the Polkadot ecosystem networks and learn the unique purposes of each, tailored for blockchain innovation, testing, and enterprise-grade solutions. - [Add a Pallet to the Runtime](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/parachains/customize-parachain/add-existing-pallets.md): Learn how to include and configure pallets in a Polkadot SDK-based runtime, from adding dependencies to implementing necessary traits. @@ -182,7 +182,7 @@ - [Opening HRMP Channels Between Parachains](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/tutorials/interoperability/xcm-channels/para-to-para.md): Learn how to open HRMP channels between parachains on Polkadot. Discover the step-by-step process for establishing uni- and bidirectional communication. - [Opening HRMP Channels with System Parachains](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/tutorials/interoperability/xcm-channels/para-to-system.md): Learn how to open HRMP channels with Polkadot system parachains. Discover the process for establishing bi-directional communication using a single XCM message. - [XCM Fee Estimation](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/tutorials/interoperability/xcm-fee-estimation.md): This tutorial demonstrates how to estimate the fees for teleporting assets from the Paseo Asset Hub parachain to the Paseo Bridge Hub chain. -- [XCM Observability in Action](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/tutorials/interoperability/xcm-observability-in-action.md): A hands-on guide to tracing, correlating, and debugging cross-chain XCMs using observability tools in the Polkadot SDK. +- [XCM Observability in Action](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/tutorials/interoperability/xcm-observability-in-action.md): Follow this step-by-step guide to trace, correlate, and debug cross-chain XCMs using observability tools in the Polkadot SDK. - [XCM Transfers from Relay Chain to Parachain](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/tutorials/interoperability/xcm-transfers/from-relaychain-to-parachain.md): Learn how to perform a reserve-backed asset transfer between a relay chain and a parachain using XCM for cross-chain interoperability. - [XCM Transfers](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/tutorials/interoperability/xcm-transfers/index.md): Explore tutorials on performing transfers between different consensus systems using XCM technology to enable cross-chain interoperability. - [Fast Track a Governance Proposal](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/tutorials/onchain-governance/fast-track-gov-proposal.md): Learn how to fast-track governance proposals in Polkadot's OpenGov using Chopsticks. Simulate, test, and execute proposals confidently. From 5551dd360536f1d8f3760e1e9e7b0d35fc62cca6 Mon Sep 17 00:00:00 2001 From: Dawn Kelly <83190195+dawnkelly09@users.noreply.github.com> Date: Mon, 15 Sep 2025 15:27:38 -0400 Subject: [PATCH 5/6] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- develop/interoperability/xcm-observability.md | 2 +- tutorials/interoperability/xcm-observability-in-action.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/develop/interoperability/xcm-observability.md b/develop/interoperability/xcm-observability.md index 2a2955b6f..9ea065b0f 100644 --- a/develop/interoperability/xcm-observability.md +++ b/develop/interoperability/xcm-observability.md @@ -1,6 +1,6 @@ --- title: XCM Observability -description: This conceptual overview of XCM observability in Polkadot covers message correlation, tracing, and debugging features in modern runtimes. +description: A conceptual overview of XCM observability in Polkadot covers message correlation, tracing, and debugging features in modern runtimes. --- # XCM Observability diff --git a/tutorials/interoperability/xcm-observability-in-action.md b/tutorials/interoperability/xcm-observability-in-action.md index 5bb5dd017..6a9d16294 100644 --- a/tutorials/interoperability/xcm-observability-in-action.md +++ b/tutorials/interoperability/xcm-observability-in-action.md @@ -47,7 +47,7 @@ Before you begin, ensure you have the following: wget https://github.com/polkadot-fellows/runtimes/releases/download/v1.6.0/asset-hub-polkadot_runtime-v1006000.compact.compressed.wasm -O wasms/asset-hub-polkadot_v1.6.0.wasm ``` -4. Download the config for Polkadot Hub: +4. Download the config file for Polkadot Hub: ```bash mkdir -p configs From ef9329b6f937f8b162770fd4ba1cd24cab8ee08e Mon Sep 17 00:00:00 2001 From: Raymond Cheung <178801527+raymondkfcheung@users.noreply.github.com> Date: Tue, 30 Sep 2025 12:33:05 +0100 Subject: [PATCH 6/6] Update wording on manual `SetTopic` (#1002) * Update wording for custom SetTopic * Update wording for custom SetTopic * Update wording for custom SetTopic --- develop/interoperability/xcm-observability.md | 4 +++- llms-full.txt | 10 ++++++---- llms.txt | 2 +- .../interoperability/xcm-observability-in-action.md | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/develop/interoperability/xcm-observability.md b/develop/interoperability/xcm-observability.md index 9ea065b0f..28104830c 100644 --- a/develop/interoperability/xcm-observability.md +++ b/develop/interoperability/xcm-observability.md @@ -48,7 +48,7 @@ Matching these IDs allows you to correlate an origin message with its destinatio - The runtime automatically appends a `SetTopic` instruction if one is missing at the end of an XCM. - When using high-level extrinsics such as `limited_reserve_transfer_assets`, you do not need to set a topic manually; the runtime handles it for you. -- If you manually craft an XCM (e.g., via [`execute`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/struct.Pallet.html#method.execute){target=\_blank} or [`send`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/struct.Pallet.html#method.send){target=\_blank}), you can supply your own `SetTopic`, but it must be the final instruction to be respected. +- When manually crafting an XCM via [`execute`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/struct.Pallet.html#method.execute){target=\_blank} or [`send`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/struct.Pallet.html#method.send){target=\_blank}), you can include a `SetTopic` as the final instruction; otherwise, `WithUniqueTopic` will append its own unique ID, overriding earlier `SetTopic` instructions. - In multi-hop XCM flows, manually setting the topic ensures consistent tracing across all hops. Any remote XCM calls embedded inside the XCM must also include a `SetTopic` at the end to preserve the same `message_id` throughout the cross-chain flow. ## Message Lifecycle @@ -99,6 +99,8 @@ Tools and indexers tracing messages across mixed runtime versions should check b --8<-- 'code/develop/interoperability/xcm-observability/forward-id-for.ts' ``` +> Note: `@noble/hashes` and `polkadot-api` are required dependencies for this code to work. + ## Failure Event Handling 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: diff --git a/llms-full.txt b/llms-full.txt index 51b343508..49bca7a77 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -3163,7 +3163,7 @@ Doc-Content: https://docs.polkadot.com/develop/interoperability/xcm-observabilit --- BEGIN CONTENT --- --- title: XCM Observability -description: This conceptual overview of XCM observability in Polkadot covers message correlation, tracing, and debugging features in modern runtimes. +description: A conceptual overview of XCM observability in Polkadot covers message correlation, tracing, and debugging features in modern runtimes. --- # XCM Observability @@ -3211,7 +3211,7 @@ Matching these IDs allows you to correlate an origin message with its destinatio - The runtime automatically appends a `SetTopic` instruction if one is missing at the end of an XCM. - When using high-level extrinsics such as `limited_reserve_transfer_assets`, you do not need to set a topic manually; the runtime handles it for you. -- If you manually craft an XCM (e.g., via [`execute`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/struct.Pallet.html#method.execute){target=\_blank} or [`send`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/struct.Pallet.html#method.send){target=\_blank}), you can supply your own `SetTopic`, but it must be the final instruction to be respected. +- When manually crafting an XCM via [`execute`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/struct.Pallet.html#method.execute){target=\_blank} or [`send`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/struct.Pallet.html#method.send){target=\_blank}), you can include a `SetTopic` as the final instruction; otherwise, `WithUniqueTopic` will append its own unique ID, overriding earlier `SetTopic` instructions. - In multi-hop XCM flows, manually setting the topic ensures consistent tracing across all hops. Any remote XCM calls embedded inside the XCM must also include a `SetTopic` at the end to preserve the same `message_id` throughout the cross-chain flow. ## Message Lifecycle @@ -3293,6 +3293,8 @@ if (forwardedIdHex === expectedForwardedId) { } ``` +> Note: `@noble/hashes` and `polkadot-api` are required dependencies for this code to work. + ## Failure Event Handling 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: @@ -31110,7 +31112,7 @@ Before you begin, ensure you have the following: wget https://github.com/polkadot-fellows/runtimes/releases/download/v1.6.0/asset-hub-polkadot_runtime-v1006000.compact.compressed.wasm -O wasms/asset-hub-polkadot_v1.6.0.wasm ``` -4. Download the config for Polkadot Hub: +4. Download the config file for Polkadot Hub: ```bash mkdir -p configs @@ -31148,7 +31150,7 @@ Before you begin, ensure you have the following: ```bash npm install --save-dev typescript @types/node tsx - npm install polkadot-api @polkadot-labs/hdkd @polkadot-labs/hdkd-helpers + npm install polkadot-api @polkadot-labs/hdkd @polkadot-labs/hdkd-helpers npm install @noble/hashes ``` diff --git a/llms.txt b/llms.txt index 708d07483..ca2c804c8 100644 --- a/llms.txt +++ b/llms.txt @@ -25,7 +25,7 @@ - [Transact](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-guides/from-apps/transact.md): Learn how to execute arbitrary calls on remote chains using the Transact instruction, enabling cross-chain function execution and remote pallet interactions. - [Transfers](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-guides/from-apps/transfers.md): Learn how to perform cross-chain asset transfers using XCM, including teleport, reserve transfers, and handling different asset types across parachains. - [XCM Guides](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-guides/index.md): Comprehensive guides for implementing XCM functionality in applications and understanding cross-chain interactions. -- [XCM Observability](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-observability.md): This conceptual overview of XCM observability in Polkadot covers message correlation, tracing, and debugging features in modern runtimes. +- [XCM Observability](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-observability.md): A conceptual overview of XCM observability in Polkadot covers message correlation, tracing, and debugging features in modern runtimes. - [XCM Runtime APIs](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/interoperability/xcm-runtime-apis.md): Learn about XCM Runtime APIs in Polkadot for cross-chain communication. Explore the APIs to simulate and test XCM messages before execution on the network. - [Networks](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/networks.md): Explore the Polkadot ecosystem networks and learn the unique purposes of each, tailored for blockchain innovation, testing, and enterprise-grade solutions. - [Add a Pallet to the Runtime](https://raw.githubusercontent.com/polkadot-developers/polkadot-docs/refs/heads/master/develop/parachains/customize-parachain/add-existing-pallets.md): Learn how to include and configure pallets in a Polkadot SDK-based runtime, from adding dependencies to implementing necessary traits. diff --git a/tutorials/interoperability/xcm-observability-in-action.md b/tutorials/interoperability/xcm-observability-in-action.md index 6a9d16294..c04d49299 100644 --- a/tutorials/interoperability/xcm-observability-in-action.md +++ b/tutorials/interoperability/xcm-observability-in-action.md @@ -85,7 +85,7 @@ Before you begin, ensure you have the following: ```bash npm install --save-dev typescript @types/node tsx - npm install polkadot-api @polkadot-labs/hdkd @polkadot-labs/hdkd-helpers + npm install polkadot-api @polkadot-labs/hdkd @polkadot-labs/hdkd-helpers npm install @noble/hashes ```