-
Notifications
You must be signed in to change notification settings - Fork 45
Add Guide: Replay & Dry Run XCMs with Full Logging Using Chopsticks #734
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?
Add Guide: Replay & Dry Run XCMs with Full Logging Using Chopsticks #734
Conversation
|
||
* Launch Chopsticks using the chain config files | ||
|
||
* All config files should have `runtime-log-level: 5` set to enable detailed execution logs for debugging. |
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.
A not-at-all trivial comment. Logs only work if the runtime was compiled with logs. debug
and release
profiles work, production
profile doesn't. Live chain runtimes, or most of them at least, have been compiled with the production
profile. This means people need to manually compile the runtimes with the release
profile, or we can provide them with the correct runtimes with logs. I would go for the second one and try to push teams to publish release
runtimes alongside every release.
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.
Updated with instructions on how to compile the runtime.
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 second approach is at polkadot-fellows/runtimes#767
### 3. Replay the XCM | ||
|
||
```ts | ||
import { ApiPromise, WsProvider, Keyring } from '@polkadot/api'; |
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 would use PAPI here to align with the latest tools
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.
Changed
--p acala | ||
``` | ||
|
||
### 3. Replay the XCM |
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.
If you just want to replay the XCM, you can get the tx from the indexer (subscan for example) and use PAPI's api.txFromCallData()
to get the same transaction and execute it.
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.
OK, I'll find a real world example.
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.
Changed and the real world example is at here.
const tx = api.tx.polkadotXcm.send( | ||
{ | ||
V5: { | ||
parents: 1, | ||
interior: 'Here' | ||
} | ||
}, | ||
{ | ||
V5: [ | ||
{ SetTopic: '0x' + '00'.repeat(28) + '12345678' } | ||
] | ||
} | ||
); |
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 message doesn't do much. Also, send()
is probably not what you want, it's usually execute()
. send()
will automatically add a DescendOrigin
instruction which will affect the behavior of the real message. Most XCMs in the wild are cross-chain transfers which start with a local execute()
.
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.
Changed. The working sample is at here.
develop/toolkit/parachains/fork-chains/chopsticks/replay-xcm.md
Outdated
Show resolved
Hide resolved
|
||
* Chopsticks is running on port `8000` | ||
* Your're connected to a chain that supports `polkadotXcm.send` (e.g. a Polkadot Asset Hub fork) | ||
|
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 would add screenshots of the chopsticks logs when you execute an XCM
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.
Added the console log
</a> | ||
</div> | ||
<div class="card"> | ||
<a href="/learn/learn-xcm/"> |
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.
Is this link correct? I believe it should be /develop/interoperability/
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.
My bad, updated.
Co-authored-by: Francisco Aguirre <[email protected]>
mkdir -p ~/projects && cd ~/projects | ||
git clone [email protected]:polkadot-fellows/runtimes.git | ||
cd runtimes | ||
cargo build --release -p asset-hub-polkadot-runtime |
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.
cargo build --release -p asset-hub-polkadot-runtime | |
cargo build --debug -p asset-hub-polkadot-runtime |
or is all logging enabled even for --release
?
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.
Dropped --release
|
||
```bash | ||
mkdir -p ~/projects/replay-xcm-tests/wasms | ||
cp target/release/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm ~/projects/replay-xcm-tests/wasms/ |
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.
same everywhere
cp target/release/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm ~/projects/replay-xcm-tests/wasms/ | |
cp target/debug/wbuild/asset-hub-polkadot-runtime/asset_hub_polkadot_runtime.compact.compressed.wasm ~/projects/replay-xcm-tests/wasms/ |
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.
Changed
This PR adds a new guide under the Polkadot SDK documentation that explains how to replay and dry-run XCMs using Chopsticks with full logging enabled.
The tutorial covers:
This addresses Issue #488 by providing a step-by-step developer workflow for XCM observability and debugging in a local environment.