Skip to content
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

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

Merged
merged 5 commits into from
Sep 19, 2024

Conversation

franciscoaguirre
Copy link
Contributor

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.

@franciscoaguirre franciscoaguirre added the T6-XCM This PR/Issue is related to XCM. label Sep 16, 2024
@franciscoaguirre franciscoaguirre self-assigned this Sep 16, 2024
@acatangiu acatangiu added this pull request to the merge queue Sep 19, 2024
@acatangiu acatangiu added the A4-needs-backport Pull request must be backported to all maintained releases. label Sep 19, 2024
Merged via the queue into master with commit b230b0e Sep 19, 2024
240 of 242 checks passed
@acatangiu acatangiu deleted the xcm-emulator-better-transport-logs branch September 19, 2024 07:14
@paritytech-cmd-bot-polkadot-sdk

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

github-actions bot pushed a commit that referenced this pull request Sep 19, 2024
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:

<img width="1499" alt="Screenshot 2024-09-13 at 20 14 13"
src="https://github.com/user-attachments/assets/a31d7aa4-11d1-4d3e-9a65-86f38347c880">

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:

<img width="1499" alt="Screenshot 2024-09-13 at 20 17 15"
src="https://github.com/user-attachments/assets/5abf4a97-1ea7-4832-b3b0-d54c54905d1a">

The HRMP and UMP ones are very similar.

(cherry picked from commit b230b0e)
@paritytech-cmd-bot-polkadot-sdk

Successfully created backport PR for stable2409:

acatangiu pushed a commit that referenced this pull request Sep 19, 2024
Backport #5712 into `stable2409` from franciscoaguirre.

Now the XCM emulator has a log every time `execute_with` is called, to know
which chain is being used.
Also, the logs for UMP, DMP, HRMP processing were included in the `xcm` log filter
and changed from showing the message as an array of bytes to a hex string.
This means running the tests with `RUST_LOG=xcm` should give you everything you
need, you can always filter by `RUST_LOG=xcm::hrmp` or any other if you need it.

Co-authored-by: Francisco Aguirre <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A4-needs-backport Pull request must be backported to all maintained releases. T6-XCM This PR/Issue is related to XCM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants