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

Emit New Event with Message Hash and ID on DMP Message Sent #1905

Open
2 tasks done
XY-Wang opened this issue Oct 17, 2023 · 1 comment
Open
2 tasks done

Emit New Event with Message Hash and ID on DMP Message Sent #1905

XY-Wang opened this issue Oct 17, 2023 · 1 comment
Labels
I5-enhancement An additional feature request. I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@XY-Wang
Copy link

XY-Wang commented Oct 17, 2023

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Motivation

We found out that there is currently no reliable method to correlate the initiating extrinsic e.g. xcmpallet.teleportAssets with the corresponding DMP message, since the message hash or the message ID is not emitted in an event related to the extrinsic.

Presently, we are employing some heuristics to match messages at origin and destination:

  1. The sender initiates a DMP message through an extrinsic of the xcmpallet. We monitor these extrinsics and parse the parameters to obtain the destination paraId
  2. An event xcmpallet.Attempted is emitted, indicating the outcome.
  3. If the outcome is Completed, the message enters the dmp.downwardMessageQueues.
  4. We query the dmp.downwardMessageQueues storage at the block of the originating extrinsic, using the destination paraId, to get all messages in the queue.
  5. We parse each message data to extract the instruction set and attempt to match the parameters of the extrinsic with the instructions.
  6. If a match is found, we hash the message data to obtain the message hash and store it for matching at the destination.
  7. When the message is routed to the destination, an event dmpqueue.ExecutedDownward is emitted, including the message hash, ID, and outcome. We match the emitted message hash with the one stored in step 6.

These heuristics work for most of the cases, especially considering the low volume of cross-chain messages right now.
However, in the case of multiple DMP messages at the same block for the same destination chain with identical instructions and parameters, it becomes impossible to know, with the heuristics, from which extrinsic they originate.

Request

We propose emitting an event from the originating extrinsic containing both the message hash and ID. This enhancement will greatly simplify the process of matching messages while also solving the issue of correlating to the originating extrinsic.

Solution

Found this open PR that should solve the issue in the archived Polkadot repo but I couldn't find it in this repo: Introduced events for dmp DownwardMessageSent + refactor to common MessageId for events (ump, dmp)

Related work done for UMP: Add event for showing the hash of a UMP sent message

Are you willing to help with this request?

Maybe (please elaborate above)

@XY-Wang XY-Wang added the I5-enhancement An additional feature request. label Oct 17, 2023
@github-actions github-actions bot added the I10-unconfirmed Issue might be valid, but it's not yet known. label Oct 17, 2023
@bkontur
Copy link
Contributor

bkontur commented Oct 17, 2023

@XY-Wang yes, that's my PR and I have not ported it yet, but I could do it now when needed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request. I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
None yet
Development

No branches or pull requests

2 participants