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

Add XCM transfers support #250

Merged
merged 3 commits into from
Aug 6, 2024
Merged

Add XCM transfers support #250

merged 3 commits into from
Aug 6, 2024

Conversation

vovacha
Copy link
Contributor

@vovacha vovacha commented Aug 4, 2024

Added XCM transfers monitoring with minimal changes to the internal API. The goal was to integrate XCM pallet monitoring alongside the existing Balances pallet monitoring based on the Transfer event.

The XCM format is evolving to be more flexible, allowing extrinsics to take custom XCM messages as input. Currently, the processing is tied to a standard message format created by the extrinsics themselves. The extrinsics operating with the custom messages like execute and sent are not widely used yet, except for the transfer_assets_using_type_and_then.

Overview

  • Added XCM Sent event processing logic based on the XCM Message Instructions.
  • There is a common interface to deal with all transfer events extractTransferInfoFromEvent + isTransferEvent (both Balances and XCM).
  • Added types and type augmentation (Polkadot types are used even for the Kusama chain).
  • Minor changes based on the updated linters.
  • Minor Event Scanner changes:
    • Renamed networkId => chainInfo.
    • Renamed _balanceTransferHandler => _transferNotificationHandler.
    • Added extractTransferInfoFromEvent dependency injection.

The event processing logic is described on the picture below.

xcm-processing

Tests

Added integration tests based on the Polkadot and Kusama chains.

$yarn test:integration

    ✔ Pallet Balances. Batch, proxy, multisig (371ms)
    ✔ Pallet XCM. Call limited_teleport_assets - V2 dest 1000 (207ms)
    ✔ Pallet XCM. Multisig dest 1000 (352ms)
    ✔ Pallet XCM. Call limited_teleport_assets - XCM V2 dest 1000 (187ms)
    ✔ Pallet XCM. Call limited_teleport_assets - XCM V3 dest 1004 (192ms)
    ✔ Pallet XCM. Call teleport_assets - XCM V2 dest 1001 (336ms)
    ✔ Pallet XCM. Call transfer_assets - XCM V3 dest 1000 (342ms)
    ✔ Pallet XCM. Call reserve_transfer_assets - XCM V2 dest 2012 (190ms)
    ✔ Pallet XCM. Call limited_reserve_transfer_assets - XCM V3 dest 2000 (210ms)
    ✔ Pallet XCM. Call transfer_assets_using_type_and_then - custom XCM on dest AssetHub (209ms)
    ✔ Pallet XCM. Call smart contract destination - 2004 Moonbeam (187ms)

@vovacha vovacha requested a review from ironoa August 5, 2024 09:59
@vovacha vovacha self-assigned this Aug 5, 2024
@vovacha vovacha marked this pull request as ready for review August 5, 2024 09:59
package.json Outdated Show resolved Hide resolved
@vovacha vovacha requested a review from ironoa August 6, 2024 11:52
@vovacha vovacha merged commit 39ded68 into master Aug 6, 2024
8 checks passed
@vovacha vovacha deleted the feature/xcm branch August 6, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants