You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: llms.txt
+80-24Lines changed: 80 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -27852,26 +27852,37 @@ If you haven't replayed or dry-run XCMs before, see the [Replay and Dry Run XCMs
27852
27852
27853
27853
## Understanding the Basics
27854
27854
27855
-
When sending XCMs using `limited_reserve_transfer_assets` or other extrinsics from the `PolkadotXcm` pallet, two key observability features enable you to trace and correlate messages across chains:
27855
+
When sending XCMs using `limited_reserve_transfer_assets` or other extrinsics from the `PolkadotXcm` pallet, two key observability features enable developers to trace and correlate messages across chains:
An XCM instruction that sets the Topic Register. This 32-byte array becomes the `message_id`, which is recorded in both the `PolkadotXcm.Sent` and `MessageQueue.Processed` events. It allows logical grouping or filtering of related messages across multiple hops.
27857
+
- [`SetTopic([u8; 32])`](https://github.com/polkadot-fellows/xcm-format#settopic){target=\_blank}: An XCM instruction that sets the **Topic Register**. This 32-byte value becomes the `message_id`, which appears in both the `PolkadotXcm.Sent` and `MessageQueue.Processed` events. It allows logical grouping and filtering of related messages across one or more hops.
27859
27858
27860
-
> ⚠️ **Note**: The topic is **not guaranteed to be unique**. If uniqueness is required (for example, for deduplication or traceability), it must be enforced by the message creator.
27859
+
> ⚠️ **Note**: The topic is **not guaranteed to be unique**. If uniqueness is required (e.g. for deduplication or message tracking), it must be enforced by the message creator.
27861
27860
27862
-
- **`message_id`**
27863
-
A hash emitted in both the [`PolkadotXcm.Sent`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/enum.Event.html#variant.Sent){target=\_blank} event on the origin chain and the [`MessageQueue.Processed`](https://paritytech.github.io/polkadot-sdk/master/pallet_message_queue/pallet/enum.Event.html#variant.Processed){target=\_blank} event on the destination chain. While this identifier is not globally unique, it is sufficient to match a `Sent` message with its corresponding `Processed` result.
27861
+
- `message_id`: A hash emitted in both the [`PolkadotXcm.Sent`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/enum.Event.html#variant.Sent){target=\_blank} event (on the origin chain) and the [`MessageQueue.Processed`](https://paritytech.github.io/polkadot-sdk/master/pallet_message_queue/pallet/enum.Event.html#variant.Processed){target=\_blank} event (on the destination chain). While not globally unique, it is sufficient to match a `Sent` message with its corresponding `Processed` result.
27864
27862
27865
-
These observability features are available in runtimes built from **`stable2503-5` or later**.
27863
+
These features are available in runtimes built from **`stable2503-5` or later**.
27864
+
27865
+
### Key Behaviours
27866
+
27867
+
- The runtime **automatically appends** a `SetTopic` instruction at the end of the XCM, if it is not already included. See: [`WithUniqueTopic`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm_builder/struct.WithUniqueTopic.html){target=\_blank}
27868
+
27869
+
- When using high-level extrinsics such as `limited_reserve_transfer_assets`, you do **not** need to include `SetTopic` manually. The runtime will insert it for you.
27870
+
27871
+
- If you are constructing an XCM manually using the `execute` call, you **can provide your own** `SetTopic([u8; 32])`:
27872
+
27873
+
- If a topic is already set, the runtime will **not override** it.
27874
+
- `SetTopic` **must be the final instruction** in the list. Placing it elsewhere will result in it being ignored during execution.
27875
+
27876
+
- On newer runtimes, the same topic is preserved throughout a multi-hop transfer. This ensures consistent correlation of the `message_id` between origin and destination, even across multiple chains.
27866
27877
27867
27878
## Define a Scenario: DOT to Acala Transfer
27868
27879
27869
27880
We will examine the full lifecycle of a cross-chain message from Polkadot Asset Hub to Acala, using the `limited_reserve_transfer_assets` extrinsic.
- **Goal**: Transfer DOT and trace the XCM using its emitted `message_id`
27875
27886
27876
27887
This scenario demonstrates how a `SetTopic` is included or generated, how to identify matching `Sent` and `Processed` events, and how to interpret failures using runtime logs.
27877
27888
@@ -28157,7 +28168,7 @@ The runtime automatically inserts a `SetTopic` instruction (if not manually prov
28157
28168
| Origin (e.g. Asset Hub) | `PolkadotXcm.Sent` | `message_id` | Message ID from `SetTopic`. Appended automatically if missing. |
28158
28169
| Destination (e.g. Acala, Hydration) | `MessageQueue.Processed` | `id` | Matches `message_id` from the origin chain, enabling reliable correlation. |
28159
28170
28160
-
**These two fields now match** on new runtimes (`stable2503-5` or later).
28171
+
These two fields now match on new runtimes (`stable2503-5` or later).
28161
28172
28162
28173
> ⚠️ Do not rely on [`XcmpQueue.XcmpMessageSent`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_xcmp_queue/pallet/enum.Event.html#variant.XcmpMessageSent){target=\_blank}. Its `message_hash` is not derived from `SetTopic` and is not suitable for cross-chain tracking.
28163
28174
@@ -28207,15 +28218,15 @@ This output is available on runtimes from **`stable2506` or later**, and is ofte
28207
28218
28208
28219
For deeper analysis:
28209
28220
28210
-
* Use Chopsticks to **replay the message with logging enabled**
28211
-
* See exactly **which instruction failed**, and why
28212
-
* View full error chains like `FailedToTransactAsset`, or `AssetNotFound`
28221
+
- Use Chopsticks to **replay the message with logging enabled**
28222
+
- See exactly **which instruction failed**, and why
28223
+
- View full error chains like `FailedToTransactAsset`, or `AssetNotFound`
28213
28224
28214
28225
This is especially useful when dealing with:
28215
28226
28216
-
* Multi-hop XCMs
28217
-
* Custom asset locations
28218
-
* Execution mismatches or weight issues
28227
+
- Multi-hop XCMs
28228
+
- Custom asset locations
28229
+
- Execution mismatches or weight issues
28219
28230
28220
28231
→ For replay setup, see [Replay and Dry Run XCMs Using Chopsticks](/tutorials/interoperability/replay-and-dry-run-xcms/){target=\_blank}.
28221
28232
@@ -28226,17 +28237,62 @@ This is especially useful when dealing with:
28226
28237
3. **Inspect logs** to pinpoint the failing instruction and error.
28227
28238
4. Adjust asset location, weight, or execution logic accordingly.
28228
28239
28229
-
## Step 5: Handle Older Runtimes
28240
+
## Workaround for Older Runtimes
28241
+
28242
+
* On **older runtimes** (prior to `stable2503-5`), the `message_id` seen in downstream `Processed` events is **not the original topic hash**, but rather a **derived `forwarded_id`**.
Copy file name to clipboardExpand all lines: tutorials/interoperability/xcm-observability.md
+49-24Lines changed: 49 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,26 +32,37 @@ If you haven't replayed or dry-run XCMs before, see the [Replay and Dry Run XCMs
32
32
33
33
## Understanding the Basics
34
34
35
-
When sending XCMs using `limited_reserve_transfer_assets` or other extrinsics from the `PolkadotXcm` pallet, two key observability features enable you to trace and correlate messages across chains:
35
+
When sending XCMs using `limited_reserve_transfer_assets` or other extrinsics from the `PolkadotXcm` pallet, two key observability features enable developers to trace and correlate messages across chains:
An XCM instruction that sets the Topic Register. This 32-byte array becomes the `message_id`, which is recorded in both the `PolkadotXcm.Sent` and `MessageQueue.Processed` events. It allows logical grouping or filtering of related messages across multiple hops.
37
+
-[`SetTopic([u8; 32])`](https://github.com/polkadot-fellows/xcm-format#settopic){target=\_blank}: An XCM instruction that sets the **Topic Register**. This 32-byte value becomes the `message_id`, which appears in both the `PolkadotXcm.Sent` and `MessageQueue.Processed` events. It allows logical grouping and filtering of related messages across one or more hops.
39
38
40
-
> ⚠️ **Note**: The topic is **not guaranteed to be unique**. If uniqueness is required (for example, for deduplication or traceability), it must be enforced by the message creator.
39
+
> ⚠️ **Note**: The topic is **not guaranteed to be unique**. If uniqueness is required (e.g. for deduplication or message tracking), it must be enforced by the message creator.
41
40
42
-
-**`message_id`**
43
-
A hash emitted in both the [`PolkadotXcm.Sent`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/enum.Event.html#variant.Sent){target=\_blank} event on the origin chain and the [`MessageQueue.Processed`](https://paritytech.github.io/polkadot-sdk/master/pallet_message_queue/pallet/enum.Event.html#variant.Processed){target=\_blank} event on the destination chain. While this identifier is not globally unique, it is sufficient to match a `Sent` message with its corresponding `Processed` result.
41
+
-`message_id`: A hash emitted in both the [`PolkadotXcm.Sent`](https://paritytech.github.io/polkadot-sdk/master/pallet_xcm/pallet/enum.Event.html#variant.Sent){target=\_blank} event (on the origin chain) and the [`MessageQueue.Processed`](https://paritytech.github.io/polkadot-sdk/master/pallet_message_queue/pallet/enum.Event.html#variant.Processed){target=\_blank} event (on the destination chain). While not globally unique, it is sufficient to match a `Sent` message with its corresponding `Processed` result.
44
42
45
-
These observability features are available in runtimes built from **`stable2503-5` or later**.
43
+
These features are available in runtimes built from **`stable2503-5` or later**.
44
+
45
+
### Key Behaviours
46
+
47
+
- The runtime **automatically appends** a `SetTopic` instruction at the end of the XCM, if it is not already included. See: [`WithUniqueTopic`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm_builder/struct.WithUniqueTopic.html){target=\_blank}
48
+
49
+
- When using high-level extrinsics such as `limited_reserve_transfer_assets`, you do **not** need to include `SetTopic` manually. The runtime will insert it for you.
50
+
51
+
- If you are constructing an XCM manually using the `execute` call, you **can provide your own**`SetTopic([u8; 32])`:
52
+
53
+
- If a topic is already set, the runtime will **not override** it.
54
+
-`SetTopic`**must be the final instruction** in the list. Placing it elsewhere will result in it being ignored during execution.
55
+
56
+
- On newer runtimes, the same topic is preserved throughout a multi-hop transfer. This ensures consistent correlation of the `message_id` between origin and destination, even across multiple chains.
46
57
47
58
## Define a Scenario: DOT to Acala Transfer
48
59
49
60
We will examine the full lifecycle of a cross-chain message from Polkadot Asset Hub to Acala, using the `limited_reserve_transfer_assets` extrinsic.
50
61
51
-
***Origin chain**: Polkadot Asset Hub
52
-
***Destination chain**: Acala
53
-
***Extrinsic**: `limited_reserve_transfer_assets`
54
-
***Goal**: Transfer DOT and trace the XCM using its emitted `message_id`
62
+
-**Origin chain**: Polkadot Asset Hub
63
+
-**Destination chain**: Acala
64
+
-**Extrinsic**: `limited_reserve_transfer_assets`
65
+
-**Goal**: Transfer DOT and trace the XCM using its emitted `message_id`
55
66
56
67
This scenario demonstrates how a `SetTopic` is included or generated, how to identify matching `Sent` and `Processed` events, and how to interpret failures using runtime logs.
57
68
@@ -119,7 +130,7 @@ The runtime automatically inserts a `SetTopic` instruction (if not manually prov
119
130
| Origin (e.g. Asset Hub) |`PolkadotXcm.Sent`|`message_id`| Message ID from `SetTopic`. Appended automatically if missing. |
120
131
| Destination (e.g. Acala, Hydration) |`MessageQueue.Processed`|`id`| Matches `message_id` from the origin chain, enabling reliable correlation. |
121
132
122
-
**These two fields now match** on new runtimes (`stable2503-5` or later).
133
+
These two fields now match on new runtimes (`stable2503-5` or later).
123
134
124
135
> ⚠️ Do not rely on [`XcmpQueue.XcmpMessageSent`](https://paritytech.github.io/polkadot-sdk/master/cumulus_pallet_xcmp_queue/pallet/enum.Event.html#variant.XcmpMessageSent){target=\_blank}. Its `message_hash` is not derived from `SetTopic` and is not suitable for cross-chain tracking.
125
136
@@ -143,15 +154,15 @@ This output is available on runtimes from **`stable2506` or later**, and is ofte
143
154
144
155
For deeper analysis:
145
156
146
-
* Use Chopsticks to **replay the message with logging enabled**
147
-
* See exactly **which instruction failed**, and why
148
-
* View full error chains like `FailedToTransactAsset`, or `AssetNotFound`
157
+
- Use Chopsticks to **replay the message with logging enabled**
158
+
- See exactly **which instruction failed**, and why
159
+
- View full error chains like `FailedToTransactAsset`, or `AssetNotFound`
149
160
150
161
This is especially useful when dealing with:
151
162
152
-
* Multi-hop XCMs
153
-
* Custom asset locations
154
-
* Execution mismatches or weight issues
163
+
- Multi-hop XCMs
164
+
- Custom asset locations
165
+
- Execution mismatches or weight issues
155
166
156
167
→ For replay setup, see [Replay and Dry Run XCMs Using Chopsticks](/tutorials/interoperability/replay-and-dry-run-xcms/){target=\_blank}.
157
168
@@ -162,17 +173,31 @@ This is especially useful when dealing with:
162
173
3.**Inspect logs** to pinpoint the failing instruction and error.
163
174
4. Adjust asset location, weight, or execution logic accordingly.
164
175
165
-
## Step 5: Handle Older Runtimes
176
+
## Workaround for Older Runtimes
166
177
167
-
Older runtimes use a **derived `forwarded_id`** in `Processed` events instead of the original topic hash.
178
+
* On **older runtimes** (prior to `stable2503-5`), the `message_id` seen in downstream `Processed` events is **not the original topic hash**, but rather a **derived `forwarded_id`**.
0 commit comments