1

We have local testnet with our parachain and we successfully sent KSM from relay to parachain. We have however the problem when we want to withdraw KSM back from parachain to relay chain. We always receive the error UntrustedReserveLocation

Steps: On the relay chain we set the default xcm version to 1.

xcmPallet -> forceDefaultXcmVersion, set the maybeXcmVersion field to 1

We construct the extrinsic in this form

const hexAccount = api.createType('AccountId32', 'some address here').toHex()

const dest = {
    V1: {
      parents: 1,
      interior: 'Here',
    },
}

const beneficiary = {
      V1: {
        parents: 1,
        interior: {
          X1: {
            AccountId32: {
              network: 'Any',
              id: hexAccount,
            },
          },
        },
      },
    }

const assets = {
      V1: [
        {
          id: {
            Concrete: {
              parents: 1,
              interior: 'Here',
            },
          },
          fun: {
            Fungible: HERE_IS_THE_AMOUNT,
          },
        },
      ],
    }

and then we execute tx

api.tx.polkadotXcm
    .reserveTransferAssets(dest, beneficiary, assets, '0')
    .signAndSend('some address here')

Can someone tells what could be the problem ? Thanks

3

1 Answer 1

5

Relay Chain does not recognize any other chain as a reserve: https://github.com/paritytech/polkadot/blob/master/runtime/kusama/src/xcm_config.rs#L137

Therefore, when it receives a ReserveAssetDeposited, it will fail with UntrustedReserveLocation: https://github.com/paritytech/polkadot/blob/master/xcm/xcm-executor/src/lib.rs#L288-L291

If you want to reserve transfer back you shouldn't send a ReserveAssetDeposited, you should make use of InitiateReserveWithdraw. Unfortunately, there is not yet any dispatchable in pallet-xcm to perform it, but you can find an example in xTokens: https://github.com/open-web3-stack/open-runtime-module-library/blob/c439a50e01944aedeef33231e0824a17ed1813bc/xtokens/src/lib.rs#L659-L677

2
  • Thanks Ignacio. Exactly what you describe we used now xTokens and we were able to withdraw KSM from parachain to relay chain. Thanks Jun 4, 2022 at 11:18
  • Awesome answer! Thank you! Very useful!
    – rust.dev
    Sep 27, 2022 at 16:23

Your Answer

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

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