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
description: Learn how to replay and dry-run XCMs using Chopsticks with full logging enabled. Diagnose issues, trace message flow, and debug complex cross-chain interactions.
26530
+
description: Replay and dry-run XCMs using Chopsticks with full logging enabled. Diagnose issues, trace message flow, and debug complex cross-chain interactions.
26531
26531
---
26532
26532
26533
26533
# Replay and Dry Run XCMs Using Chopsticks
@@ -26554,7 +26554,7 @@ Before you begin, make sure you have:
26554
26554
26555
26555
If you haven't forked a chain before, see the [Fork a Chain with Chopsticks guide](/tutorials/polkadot-sdk/testing/fork-live-chains/){target=\_blank} or [Fork a Network Locally using Chopsticks](https://wiki.polkadot.network/learn/learn-guides-test-opengov-proposals/#fork-a-network-locally-using-chopsticks){target=\_blank} for step-by-step instructions.
26556
26556
26557
-
## Step 1: Set Up Your Project
26557
+
## Set Up Your Project
26558
26558
26559
26559
Let's start by creating a dedicated workspace for your XCM replay and dry-run experiments.
26560
26560
@@ -26595,17 +26595,17 @@ Let's start by creating a dedicated workspace for your XCM replay and dry-run ex
26595
26595
npx tsc --init
26596
26596
```
26597
26597
26598
-
## Step 2: Capture the XCM to Replay
26598
+
## Capture the XCM to Replay
26599
26599
26600
26600
To replay a specific XCM, identify:
26601
26601
26602
26602
- The source and destination chains involved
26603
26603
- The block number or height where the XCM was sent
26604
26604
- Optionally, the call payload (if you plan to simulate it manually via development commands)
26605
26605
26606
-
You can use [Polkadot.Js Apps](/tutorials/polkadot-sdk/testing/fork-live-chains/#use-polkadotjs-apps){target=\_blank}, [papi console](https://dev.papi.how/){target=\_blank}, or indexers such as [Subscan](https://polkadot.subscan.io/xcm_dashboard){target=\_blank} to locate and inspect the original XCM execution.
26606
+
You can use [Polkadot.js Apps](/tutorials/polkadot-sdk/testing/fork-live-chains/#use-polkadotjs-apps){target=\_blank}, [papi console](https://dev.papi.how/){target=\_blank}, or indexers such as [Subscan](https://polkadot.subscan.io/xcm_dashboard){target=\_blank} to locate and inspect the original XCM execution.
26607
26607
26608
-
## Step 3: Fork the Relevant Chains
26608
+
## Fork the Relevant Chains
26609
26609
26610
26610
Use Chopsticks to [fork the required chains](/tutorials/polkadot-sdk/testing/fork-live-chains/#xcm-testing){target=\_blank} at the appropriate block heights.
Full execution logs only work if the runtime was compiled with logging enabled. Most live chains are built using the `production` profile, which disables logs. To enable logging, you'll need to override the Wasm with a locally built `release` or `debug` version. The `release` profile is faster to load in Chopsticks.
26625
26625
26626
-
1. Clone the `polkadot-fellows/runtimes` repository
26626
+
1. Clone the `polkadot-fellows/runtimes` repository:
@@ -26703,29 +26703,29 @@ Full execution logs only work if the runtime was compiled with logging enabled.
26703
26703
<span data-ty>[09:29:17.028] INFO (xcm): Connected relaychain 'Polkadot' with parachain 'Acala'</span>
26704
26704
</div>
26705
26705
26706
-
## Step 4: Identify and Extract the XCM
26706
+
## Identify and Extract the XCM
26707
26707
26708
-
To replay an XCM, you'll first need to identify the exact extrinsic that triggered it. In this example, we'll use block `#9079592` on the Polkadot Asset Hub.
26708
+
To replay an XCM, you'll first need to identify the exact extrinsic that triggered it. In this example, we'll use block 9079592 on the Polkadot Asset Hub.
26709
26709
26710
-
1. Find the block on Subscan, open the block in Subscan to inspect its extrinsics and events. In this case, the block is [`#9079592`](https://assethub-polkadot.subscan.io/block/9079592){target=\_blank}.
26710
+
1. Find and open the block on Subscan to inspect its extrinsics and events. In this case, the block is [9079592](https://assethub-polkadot.subscan.io/block/9079592){target=\_blank}.
26711
26711
26712
-
2. Copy the black hash. Look for the block hash at the top of the page. For block `#9079592`, the hash is:
26712
+
2. Copy the black hash. Look for the block hash at the top of the page. For block 9079592, the hash is:
3. Explore and view the block in [Polkadot.Js Apps](https://polkadot.js.org/apps){target=\_blank} using this direct link: [Block Hash Explorer](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-asset-hub-rpc.polkadot.io#/explorer/query/0xeb5a5737d47367dc1c02b978232283cdb096eb7e51d2eb22366a106a011347f6){target=\_blank}.
26719
26719
26720
-
4. Locate and Decode the XCM Extrinsic. Once you've found the extrinsic (e.g. `9079592-2`), extract and decode its call data. For example, the call data is:
26720
+
4. Locate and decode the XCM extrinsic. Once you've found the extrinsic (e.g., 9079592-2), extract and decode its call data. For example, the call data is:
5. Copy the call data. From the decoded view, copy the **hex-encoded call** (e.g. `0x1f08...0000`). You'll pass this into `api.txFromCallData(...)` to replay the XCM locally.
26726
+
5. From the decoded view, copy the **hex-encoded call** (e.g. `0x1f08...0000`). You'll pass this into `api.txFromCallData(...)` to replay the XCM locally.
26727
26727
26728
-
## Step 5: Replay the XCM
26728
+
## Replay the XCM
26729
26729
26730
26730
Once your project is set up, you're ready to replay the XCM locally.
26731
26731
@@ -26743,7 +26743,7 @@ This will let you use type-safe APIs with PAPI:
26743
26743
npx papi add assetHub -w ws://localhost:8000
26744
26744
```
26745
26745
26746
-
The script assumes the Polkadot Asset Hub is served on `ws://localhost:8000`. If you're using a different port or config, update the WebSocket endpoint in the script or descriptor. You can confirm the port by checking your terminal logs or see [Launch Chopsticks](#launch-chopsticks).
26746
+
The script assumes the Polkadot Asset Hub is served on `ws://localhost:8000`. If you're using a different port or config, update the WebSocket endpoint in the script or descriptor. You can confirm the port by checking your terminal logs or by seeing [Launch Chopsticks](#launch-chopsticks).
26747
26747
26748
26748
### Create a Replay Script
26749
26749
@@ -26868,7 +26868,7 @@ executing xcm: {
26868
26868
<span data-ty>✅ Process completed, exiting...</span>
26869
26869
</div>
26870
26870
26871
-
## Step 6: Dry Run the XCM
26871
+
## Dry Run the XCM
26872
26872
26873
26873
To simulate the XCM without actually sending it, you can use the `dry_run_call` method. This lets you check whether the XCM would succeed without modifying any state.
26874
26874
@@ -26967,7 +26967,7 @@ For more information, see:
26967
26967
- [Dry Run Call](/develop/interoperability/xcm-runtime-apis/#dry-run-call){target=\_blank} to simulate a full extrinsic
26968
26968
- [Dry Run XCM](/develop/interoperability/xcm-runtime-apis/#dry-run-xcm){target=\_blank} to simulate a raw XCM
26969
26969
26970
-
## Step 7: Review and Debug
26970
+
## Review and Debug
26971
26971
26972
26972
Replaying XCMs with full logging provides fine-grained control and visibility into cross-chain message behaviour. Chopsticks makes this possible in a safe, local environment – empowering developers to:
Copy file name to clipboardExpand all lines: tutorials/interoperability/replay-and-dry-run-xcms.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -206,7 +206,7 @@ This will let you use type-safe APIs with PAPI:
206
206
npx papi add assetHub -w ws://localhost:8000
207
207
```
208
208
209
-
The script assumes the Polkadot Asset Hub is served on `ws://localhost:8000`. If you're using a different port or config, update the WebSocket endpoint in the script or descriptor. You can confirm the port by checking your terminal logs or see [Launch Chopsticks](#launch-chopsticks).
209
+
The script assumes the Polkadot Asset Hub is served on `ws://localhost:8000`. If you're using a different port or config, update the WebSocket endpoint in the script or descriptor. You can confirm the port by checking your terminal logs or by seeing [Launch Chopsticks](#launch-chopsticks).
0 commit comments