paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.8k stars 652 forks source link

[xcm-emulator] Better logs for message execution and processing #5712

Closed franciscoaguirre closed 1 week ago

franciscoaguirre commented 2 weeks ago

When running XCM emulated tests and seeing the logs with RUST_LOG=xcm or RUST_LOG=xcm=trace, it's sometimes a bit hard to figure out the chain where the logs are coming from.

I added a log whenever execute_with is called, to know the chain which makes the following logs. Looks like so:

Screenshot 2024-09-13 at 20 14 13

There are already log targets for when UMP, DMP and HRMP messages are being processed. To see them, you have to use the log targets ump, dmp, and hrmp respectively. So RUST_LOG=xcm,ump,dmp,hrmp would let you see every log. I prefixed the targets with xcm:: so you can get all the relevant logs just by filtering by xcm. You can always use the whole target to see just the messages being processed.

These logs showed the message as an array of bytes, I made them show a hexadecimal string instead since that's easier to copy in case you want to decode it or use it in another tool. They look like this now:

Screenshot 2024-09-13 at 20 17 15

The HRMP and UMP ones are very similar.

paritytech-cmd-bot-polkadot-sdk[bot] commented 1 week ago

Created backport PR for stable2407:

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin backport-5712-to-stable2407
git worktree add --checkout .worktree/backport-5712-to-stable2407 backport-5712-to-stable2407
cd .worktree/backport-5712-to-stable2407
git reset --hard HEAD^
git cherry-pick -x b230b0e32b8a12ab9b53b6a1040ba26a55704947
git push --force-with-lease
paritytech-cmd-bot-polkadot-sdk[bot] commented 1 week ago

Successfully created backport PR for stable2409: