1

I'm trying to enforce a same native token rule for the relay and all future parachains in my local environment. For this, I must first configure my parachain to accept teleports from a relay account to a parachain account.

I saw that natively the cumulus template parachain has teleported disabled:

pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
    ...
    type IsTeleporter = (); // Teleporting is disabled.
    ...

So I enabled teleports from the relay chain (0.9.20 fork) by coding the following:

pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
    ...
    type IsTeleporter = (xcm_builder::Case<DotFromPolkadot>,);
    ...

parameter_types! {
    pub const DotLocation: MultiLocation = MultiLocation::parent();
    pub const Polkadot: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(DotLocation::get()) });
    pub const DotFromPolkadot: (MultiAssetFilter, MultiLocation) = (Polkadot::get(), DotLocation);
}

/// Parachain recognizes the relay chain as a teleporter.
pub type TrustedTeleporters = (xcm_builder::Case<DotFromPolkadot>,);

From what I understood the actual execution of teleporting is already implemented in the xcm pallet, and all I have to do is configure it in this xcm_config.rs inside the runtime folder.

But when running a teleport using the frontend of polkador.js.apps, it makes the runtime panic with the following message:

2022-07-28 11:22:24.026 ERROR tokio-runtime-worker runtime: [Parachain] panicked at 'assertion failed: `(left == right)`
  left: `0x01992e7b9de1178b594c0a24dc30f820d61caad33f9fda514c93c9400426d1cd`,
 right: `0x0000000000000000000000000000000000000000000000000000000000000000`', /Users/juan/.cargo/git/checkouts/cumulus-59522f43471fa161/4bbedb3/pallets/parachain-system/src/lib.rs:774:9    
2022-07-28 11:22:24.026  WARN tokio-runtime-worker sc_basic_authorship::basic_authorship: [Parachain] ❗️ Inherent extrinsic returned unexpected error: Error at calling runtime api: Execution failed: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed
WASM backtrace:

    0: 0x1bd944 - <unknown>!rust_begin_unwind
. Dropping.    
2022-07-28 11:22:24.026 ERROR tokio-runtime-worker runtime: [Parachain] panicked at 'set_validation_data inherent needs to be present in every block!', /Users/juan/.cargo/git/checkouts/cumulus-59522f43471fa161/4bbedb3/pallets/parachain-system/src/lib.rs:143:13    
2022-07-28 11:22:24.026  WARN tokio-runtime-worker aura: [Parachain] Proposing failed: Import failed: Error at calling runtime api: Execution failed: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed
WASM backtrace:

    0: 0x1bd944 - <unknown>!rust_begin_unwind

Is this because the actual teleporting logic is not implemented? or what do I have to do to enable this? Any help or direction would be appreciated.

Also if you know resources on how to implement having the same token shared between all parachains and relay chain it would be a big help!

1 Answer 1

1

The code that's panicking is this:

        // After hashing each message in the message queue chain submitted by the collator, we
        // should arrive to the MQC head provided by the relay chain.
        //
        // A mismatch means that at least some of the submitted messages were altered, omitted or
        // added improperly.
        assert_eq!(dmq_head.head(), expected_dmq_mqc_head);

So it looks to me that some messages in your DMP queue didn't get processed correctly, as the code here expects to see an empty queue, and yet dmq_head.head() is returning a non-zero value.

The way I see it, this isn't really an XCM question, but a DMP/messaging protocol question, and I unfortunately don't have much insight into how DMP works to answer what exactly you should do to solve this problem.

2
  • This asnwer is on point. Every time I have seen this happening is because some message has been pushed to the dmq_head and later on time the state of the parachain has been reset. Resulting in the mismatch between the state kept on the relay side and what is expected. One could hack around this and get rid of the error by setting the "right" value on the dmq_head storage item on the relay side. Commented Aug 8, 2022 at 14:53
  • I resolved it by disabling incremental compilation on the cargo.toml file. Don't ask me why that worked haha Commented Aug 31, 2022 at 11:45

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.