2

Link to repo

I'm trying to do a reserve-backed transfer from statemint to my own parachain of a token minted with the pallet_assets. I've been using the xcm-emulator that lets me plug in my own runtimes and do tests on them.

I managed to get this working, except that my parachain doesn't accept this token to pay for execution in the BuyExecution instruction (intended behaviour), so I wanted to also add some DOT tokens on the reserve_transfer_assets pallet call, and specify on the fee_asset_item parameter the index of DOT to use for paying the transaction. It looks something like this:

    StatemintParachain::execute_with(|| {
        let xcm = StatemintXcmPallet::reserve_transfer_assets(
            statemint_runtime::Origin::signed(ALICE),
            Box::new(MultiLocation{parents: 1, interior: X1(Parachain(2000))}.into()),
            Box::new(X1(Junction::AccountId32 {
                network: NetworkId::Any,
                id: ALICE.into()
            }).into().into()),
            Box::new(vec![
                MultiAsset {
                    id: Concrete(X2(PalletInstance(50), GeneralIndex(1)).into()),
                    fun: Fungible(500)
                },
                MultiAsset {
                    id: Concrete(Parent.into()),
                    fun: Fungible(INITIAL_BALANCE/10)
                },
            ].into()),
            1,
        );

The problem is that when adding DOT to the assets parameter, there seems to be an XCMP decoding error on the receiving parachain side:

Invalid incoming XCMP message data
thread 'tests::new_fungible_reserve_transfer' panicked at 'Invalid incoming XCMP message data', /Users/juan/.cargo/git/checkouts/cumulus-59522f43471fa161/d08055d/pallets/xcmp-queue/src/lib.rs:679:25
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:142:14
   2: cumulus_pallet_xcmp_queue::<impl cumulus_pallet_xcmp_queue::pallet::Pallet<T>>::process_xcmp_message
             at /Users/juan/.cargo/git/checkouts/cumulus-59522f43471fa161/d08055d/pallets/xcmp-queue/src/lib.rs:679:7
   3: cumulus_pallet_xcmp_queue::<impl cumulus_pallet_xcmp_queue::pallet::Pallet<T>>::service_xcmp_queue
             at /Users/juan/.cargo/git/checkouts/cumulus-59522f43471fa161/d08055d/pallets/xcmp-queue/src/lib.rs:832:40
   4: cumulus_pallet_xcmp_queue::<impl polkadot_parachain::primitives::XcmpMessageHandler for cumulus_pallet_xcmp_queue::pallet::Pallet<T>>::handle_xcmp_messages
             at /Users/juan/.cargo/git/checkouts/cumulus-59522f43471fa161/d08055d/pallets/xcmp-queue/src/lib.rs:979:3
   5: <xcm_emulator_example::AcurastParachain as polkadot_parachain::primitives::XcmpMessageHandler>::handle_xcmp_messages::{{closure}}
             at /Users/juan/Desktop/acurast-jobs/xcm-simulator/xcm-emulator/src/lib.rs:90:28
   6: environmental::using::{{closure}}
             at /Users/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/environmental-1.1.3/src/lib.rs:125:3
   7: std::thread::local::LocalKey<T>::try_with
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/thread/local.rs:445:16
   8: std::thread::local::LocalKey<T>::with
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/thread/local.rs:421:9
   9: environmental::using
             at /Users/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/environmental-1.1.3/src/lib.rs:106:2
  10: sp_externalities::scope_limited::ext::using
             at /Users/juan/.cargo/registry/src/github.com-1ecc6299db9ec823/environmental-1.1.3/src/lib.rs:252:5
  11: sp_externalities::scope_limited::set_and_run_with_externalities
             at /Users/juan/.cargo/git/checkouts/substrate-7e08433d4c370a21/3348e14/primitives/externalities/src/scope_limited.rs:31:2
  12: sp_state_machine::testing::TestExternalities<H>::execute_with
             at /Users/juan/.cargo/git/checkouts/substrate-7e08433d4c370a21/3348e14/primitives/state-machine/src/testing.rs:196:3
  13: <xcm_emulator_example::AcurastParachain as xcm_emulator::TestExt>::execute_with::{{closure}}
             at /Users/juan/Desktop/acurast-jobs/xcm-simulator/xcm-emulator/src/lib.rs:230:32
  14: std::thread::local::LocalKey<T>::try_with
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/thread/local.rs:445:16
  15: std::thread::local::LocalKey<T>::with
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/thread/local.rs:421:9
  16: <xcm_emulator_example::AcurastParachain as xcm_emulator::TestExt>::execute_with
             at /Users/juan/Desktop/acurast-jobs/xcm-simulator/xcm-emulator/src/lib.rs:230:13
  17: <xcm_emulator_example::AcurastParachain as polkadot_parachain::primitives::XcmpMessageHandler>::handle_xcmp_messages
             at /Users/juan/Desktop/acurast-jobs/xcm-simulator/xcm-emulator/src/lib.rs:90:5
  18: xcm_emulator_example::_process_horizontal_messages
             at /Users/juan/Desktop/acurast-jobs/xcm-simulator/xcm-emulator/src/lib.rs:381:8
  19: xcm_emulator_example::_process_messages
             at /Users/juan/Desktop/acurast-jobs/xcm-simulator/xcm-emulator/src/lib.rs:330:5
  20: <xcm_emulator_example::StatemintParachain as xcm_emulator::TestExt>::execute_with
             at /Users/juan/Desktop/acurast-jobs/xcm-simulator/xcm-emulator/src/lib.rs:272:5
  21: xcm_emulator_example::tests::new_fungible_reserve_transfer
             at ./src/lib.rs:547:3
  22: xcm_emulator_example::tests::new_fungible_reserve_transfer::{{closure}}
             at ./src/lib.rs:474:2
  23: core::ops::function::FnOnce::call_once
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/ops/function.rs:248:5
  24: core::ops::function::FnOnce::call_once
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: test failed, to rerun pass '--lib'

I tried instead of sending DOT, to send another minted asset, and that seems to be decoded correctly on the receiving chain. What am I Missing here?

5

1 Answer 1

2

After debugging I think it's a bug (pallet-xcm or cumulus-pallet-xcmp-queue), you can track it here: https://github.com/paritytech/cumulus/issues/1700

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.