Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

No "transfered" events triggered by XcmPallet #3489

Closed
TheGoldenEye opened this issue Jul 19, 2021 · 16 comments
Closed

No "transfered" events triggered by XcmPallet #3489

TheGoldenEye opened this issue Jul 19, 2021 · 16 comments

Comments

@TheGoldenEye
Copy link

Cross-chain transfers are using the XcmPallet. Unfortunately I cannot find an event to track the transactions. I'm looking for something like the "balances(Transfer)" event. Nothing there like this (on kusama side).
Because of the missing events there is no indication of incoming coins on the kusama side, if ksm sent from a parachain to the relay chain.
Example:
https://karura.subscan.io/extrinsic/135681-2
This transaction is not visible at destination (Hv8cTn...):
https://kusama.subscan.io/account/Hv8cTnQ9aVCQzCBgQRbR8K13uTTb8b7NMsoPApybaUzHnGx

@bkchr bkchr transferred this issue from paritytech/substrate Jul 19, 2021
@bkchr
Copy link
Member

bkchr commented Jul 19, 2021

CC @apopiak

@apopiak
Copy link
Contributor

apopiak commented Jul 20, 2021

I'm a little confused. pallet-xcm is used for sending XCMs and emits an event informing about how the XCM was processed locally ( xcmpallet(Attempted)). I assume what you mean is the receiving side where the XcmExecutor executes on Kusama and will use deposit_creating to transfer the tokens to the receiver which doesn't emit an event.

@TheGoldenEye
Copy link
Author

I miss an event that shows me the actually executed transfer of tokens (exact number) somewhere (e.g. to parachain). Something like balances(Transfer) with from, to and amount.
xcmpallet(Attempted) doesn't really help here, I don't know what to do with it. This was for transfer relay chain -> parachain.

For the other direction (transfer parachain -> relay chain) there seems to be no event at all on the relay chain.
There may be notifications on the parachain side (e.g. xtokens(Transferred) in karura), but nothing on the relay chain side.

Background:
I wrote a tool polka-store that tracks balance-relevant transactions and stores them in a database. For that i need to be able to follow all transfers, even those between the chains.

@TheGoldenEye
Copy link
Author

By the way, I still have some understanding problems with the MultiLocation:

  1. https://kusama.subscan.io/extrinsic/7812651-2 What does dest: X2 ... mean here? (context is kusama relay chain)
  2. https://westend.subscan.io/extrinsic/5871572-2 What does beneficiary: X2 ... mean?

@apopiak
Copy link
Contributor

apopiak commented Jul 21, 2021

  1. dest is the destination. So the destination of the linked XCM is Statemine (identified by the multilocation X2(Parent, Parachain(1000)) which you can read a bit like a file path ../para_1000 and specifies the destination from the sender's perspective). Edit: Note that it does not make sense to specify a Parent for Kusama as it is the relaychain.
  2. beneficiary is the receiver of the tokens sent via XCM, again specified as a multilocation. Honestly not sure right now why it specifies the parachain again and not just the AccountId32. Edit: Ah, the message was not specified correctly and failed.

Note that both of those XCMs were malformed and failed.

@apopiak
Copy link
Contributor

apopiak commented Jul 21, 2021

I miss an event that shows me the actually executed transfer of tokens (exact number) somewhere (e.g. to parachain). Something like balances(Transfer) with from, to and amount.
xcmpallet(Attempted) doesn't really help here, I don't know what to do with it. This was for transfer relay chain -> parachain.

For the other direction (transfer parachain -> relay chain) there seems to be no event at all on the relay chain.
There may be notifications on the parachain side (e.g. xtokens(Transferred) in karura), but nothing on the relay chain side.

Background:
I wrote a tool polka-store that tracks balance-relevant transactions and stores them in a database. For that i need to be able to follow all transfers, even those between the chains.

Ok. Did you see the balances(Deposit) events? They tell you about the movement of the funds. The full transfer is encoded in the XCM. As the execution (and thus failure and success) of that is distributed between two chains I'm not sure it's possible to emit the event you want. I think you might need to combine the information of the source chain's balance movements with the XCM and the target chain's balance movements.

@apopiak
Copy link
Contributor

apopiak commented Jul 21, 2021

This is what a successful teleport from the relaychain would like from the sending side: https://westend.subscan.io/extrinsic/0x530307214d7b08d723f4568f982b2af50d62a7f2bbd8db4869bd891a029eb3ea

@apopiak
Copy link
Contributor

apopiak commented Jul 21, 2021

The teleport goes out to Westmint which does not seem to trigger events when the funds are received. Will look into improving that.

@TheGoldenEye
Copy link
Author

  1. dest is the destination. So the destination of the linked XCM is Statemine (identified by the multilocation X2(Parent, Parachain(1000)) which you can read a bit like a file path ../para_1000 and specifies the destination from the sender's perspective). Edit: Note that it does not make sense to specify a Parent for Kusama as it is the relaychain.
  2. beneficiary is the receiver of the tokens sent via XCM, again specified as a multilocation. Honestly not sure right now why it specifies the parachain again and not just the AccountId32. Edit: Ah, the message was not specified correctly and failed.

Note that both of those XCMs were malformed and failed.

Hm, even though the transactions are obviously malformed, they have gone through (Result:Success). How can I tell if and how many tokens have been transferred?

@TheGoldenEye
Copy link
Author

I miss an event that shows me the actually executed transfer of tokens (exact number) somewhere (e.g. to parachain). Something like balances(Transfer) with from, to and amount.
xcmpallet(Attempted) doesn't really help here, I don't know what to do with it. This was for transfer relay chain -> parachain.
For the other direction (transfer parachain -> relay chain) there seems to be no event at all on the relay chain.
There may be notifications on the parachain side (e.g. xtokens(Transferred) in karura), but nothing on the relay chain side.
Background:
I wrote a tool polka-store that tracks balance-relevant transactions and stores them in a database. For that i need to be able to follow all transfers, even those between the chains.

Ok. Did you see the balances(Deposit) events? They tell you about the movement of the funds. The full transfer is encoded in the XCM. As the execution (and thus failure and success) of that is distributed between two chains I'm not sure it's possible to emit the event you want. I think you might need to combine the information of the source chain's balance movements with the XCM and the target chain's balance movements.

balances(Deposit) only says that fees have gone to the block producer. There is no statement about the transferred tokens.

@TheGoldenEye
Copy link
Author

This is what a successful teleport from the relaychain would like from the sending side: https://westend.subscan.io/extrinsic/0x530307214d7b08d723f4568f982b2af50d62a7f2bbd8db4869bd891a029eb3ea

yes, but i see no difference from the malformed extrinsic above

@TheGoldenEye
Copy link
Author

The teleport goes out to Westmint which does not seem to trigger events when the funds are received. Will look into improving that.

Yep, would be good.

Another problem is the transfer from westmint to westend. There is no indication (on the westend side) that tokens have been received.

@apopiak
Copy link
Contributor

apopiak commented Jul 21, 2021

This is what a successful teleport from the relaychain would like from the sending side: https://westend.subscan.io/extrinsic/0x530307214d7b08d723f4568f982b2af50d62a7f2bbd8db4869bd891a029eb3ea

yes, but i see no difference from the malformed extrinsic above

You will notice a difference in structure (e.g. both multilocations are X1 which is correct for a message sent from the relaychain to a parachain working with funds as the teleport does here). You can also see that the xcmpallet(Attempted) event says Completed which indicates that the XCM was processed successfully.

@TheGoldenEye
Copy link
Author

This is what a successful teleport from the relaychain would like from the sending side: https://westend.subscan.io/extrinsic/0x530307214d7b08d723f4568f982b2af50d62a7f2bbd8db4869bd891a029eb3ea

yes, but i see no difference from the malformed extrinsic above

You will notice a difference in structure (e.g. both multilocations are X1 which is correct for a message sent from the relaychain to a parachain working with funds as the teleport does here. You can also see that the xcmpallet(Attempted) event says Completed which indicates that the XCM was process successfully.

yes you are right, i had overlooked the complete flag, thx

@apopiak
Copy link
Contributor

apopiak commented Oct 12, 2021

This should be adressed by paritytech/substrate#9425

@apopiak apopiak closed this as completed Oct 12, 2021
@TheGoldenEye
Copy link
Author

In which runtime it will be active?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants