I'm facing the FailedToTransactAsset
error while trying to send assets from Statemint to another parachain.
So basically I have the following configuration:
Relay chain
Polkadot relay chain running with the runtime version 10000
and the latest chainspec with 2 validators: alice/bob
Parachains
Statemint(para id: 1000) - a local AssetHub
parachain
Custom Parachain(para id: 2000) - a custom parachain that has asset registry and other stuff required for transferring incoming assets
Both parachains are connected between each other with the HRMP channel so I'm able to interact with the sovereign accounts on the relay chain(transferring assets as described here) for both parachains:
[
[
[
{
sender: 1,000
recipient: 2,000
}
]
{
maxCapacity: 8
maxTotalSize: 8,192
maxMessageSize: 1,048,576
msgCount: 0
totalSize: 0
mqcHead: null
senderDeposit: 0
recipientDeposit: 0
}
]
[
[
{
sender: 2,000
recipient: 1,000
}
]
{
maxCapacity: 8
maxTotalSize: 8,192
maxMessageSize: 1,048,576
msgCount: 0
totalSize: 0
mqcHead: null
senderDeposit: 0
recipientDeposit: 0
}
]
]
I've created a sufficient
asset on the AssetHub
chain and minted some tokens to Alice
account:
I've also created an asset registry mapping for the asset above on custom parachain
:
[
[
2,983
]
{
V3: {
parents: 1
interior: {
X3: [
{
Parachain: 1,000
}
{
PalletInstance: 50
}
{
GeneralIndex: 1,983
}
]
}
}
}
]
Now I want to transfer some amount of assets to custom parachain
using polkadotXcm
limitedReserveTransferAssets
function similar to the extrinsic used here to transfer assets from Polkadot
AssetHub
to Astar
parachain:
[
{
name: "dest",
type: "xcm:VersionedMultiLocation",
type_name: "Box<VersionedMultiLocation>",
value: {
V3: {
interior: {
X1: {
Parachain: 2006
}
},
parents: 1
}
}
},
{
name: "beneficiary",
type: "xcm:VersionedMultiLocation",
type_name: "Box<VersionedMultiLocation>",
value: {
V3: {
interior: {
X1: {
AccountId32: {
id: "0x0e26695a00e4a7c696ff136e636f70b3450acfed92f345822ae89b606fcd645d",
network: null
}
}
},
parents: 0
}
}
},
{
name: "assets",
type: "xcm:VersionedMultiAssets",
type_name: "Box<VersionedMultiAssets>",
value: {
V3: [
{
fun: {
Fungible: "2200000"
},
id: {
Concrete: {
interior: {
X2: {
col0: {
PalletInstance: 50
},
col1: {
GeneralIndex: "1984"
}
}
},
parents: 0
}
}
}
]
}
},
{
name: "fee_asset_item",
type: "U32",
type_name: "u32",
value: 0
},
{
name: "weight_limit",
type: "xcm:v3:WeightLimit",
type_name: "WeightLimit",
value: {
Unlimited: ""
}
}
]
After submitting transaction I'm getting the following error with no clue like what exactly has happened:
There are no details for the FailedToTransactAsset
error. As far as I understand this is due to a conversion issue as per the source code. However there are 4 types of conversion errors
that can happen and I'm not sure which one is in my particular case:
impl From<Error> for XcmError {
fn from(e: Error) -> Self {
use XcmError::FailedToTransactAsset;
match e {
Error::AssetNotHandled => XcmError::AssetNotFound,
Error::AccountIdConversionFailed => FailedToTransactAsset("AccountIdConversionFailed"),
Error::AmountToBalanceConversionFailed =>
FailedToTransactAsset("AmountToBalanceConversionFailed"),
Error::AssetIdConversionFailed => FailedToTransactAsset("AssetIdConversionFailed"),
Error::InstanceConversionFailed => FailedToTransactAsset("InstanceConversionFailed"),
}
}
}
Any help appreciated!
UPDATE
Here is the error from the logs while using -lxcm=trace
arg:
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::execute: [Parachain] !!! ERROR: FailedToTransactAsset("AccountIdConversionFailed")
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::execute_xcm_in_credit: [Parachain] result: Err(ExecutorError { index: 0, xcm_error: FailedToTransactAsset("AccountIdConversionFailed"), weight: <wasm:stripped> })
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::execute_xcm_in_credit: [Parachain] Execution errored at 0: FailedToTransactAsset("AccountIdConversionFailed") (original_origin: MultiLocation { parents: 0, interior: Here })
Full Logs of the XCM:
2023-08-11 11:47:42.037 TRACE tokio-runtime-worker xcm::weight: [Parachain] WeightInfoBounds message: Xcm([TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: X2(PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }]), dest: MultiLocation { parents: 1, interior: X1(Parachain(2000)) }, xcm: Xcm([]) }])
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::weight: [Parachain] WeightInfoBounds message: Xcm([ReserveAssetDeposited(MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: X2(PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }])), ClearOrigin, BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: X3(Parachain(1000), PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }, weight_limit: Limited(<wasm:stripped>) }, DepositAsset { assets: Wild(AllCounted(1)), beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: None, id: [112, 97, 114, 97, 208, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }) } }])
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::weight: [Parachain] WeightInfoBounds message: Xcm([TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: X2(PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }]), dest: MultiLocation { parents: 1, interior: X1(Parachain(2000)) }, xcm: Xcm([BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: X3(Parachain(1000), PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }, weight_limit: Limited(<wasm:stripped>) }, DepositAsset { assets: Wild(AllCounted(1)), beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: None, id: [112, 97, 114, 97, 208, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }) } }]) }])
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::weight: [Parachain] WeightInfoBounds message: Xcm([TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: X2(PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }]), dest: MultiLocation { parents: 1, interior: X1(Parachain(2000)) }, xcm: Xcm([BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: X3(Parachain(1000), PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }, weight_limit: Limited(<wasm:stripped>) }, DepositAsset { assets: Wild(AllCounted(1)), beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: None, id: [112, 97, 114, 97, 208, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }) } }]) }])
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::execute_xcm_in_credit: [Parachain] origin: MultiLocation { parents: 0, interior: Here }, message: Xcm([TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: X2(PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }]), dest: MultiLocation { parents: 1, interior: X1(Parachain(2000)) }, xcm: Xcm([BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: X3(Parachain(1000), PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }, weight_limit: Limited(<wasm:stripped>) }, DepositAsset { assets: Wild(AllCounted(1)), beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: None, id: [112, 97, 114, 97, 208, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }) } }]) }]), weight_credit: <wasm:stripped>
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::barriers: [Parachain] TakeWeightCredit origin: MultiLocation { parents: 0, interior: Here }, instructions: [TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: X2(PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }]), dest: MultiLocation { parents: 1, interior: X1(Parachain(2000)) }, xcm: Xcm([BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: X3(Parachain(1000), PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }, weight_limit: Limited(<wasm:stripped>) }, DepositAsset { assets: Wild(AllCounted(1)), beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: None, id: [112, 97, 114, 97, 208, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }) } }]) }], max_weight: <wasm:stripped>, weight_credit: <wasm:stripped>
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::process: [Parachain] origin: Some(MultiLocation { parents: 0, interior: Here }), total_surplus/refunded: <wasm:stripped>/<wasm:stripped>, error_handler_weight: <wasm:stripped>
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::process_instruction: [Parachain] === TransferReserveAsset { assets: MultiAssets([MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: X2(PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }]), dest: MultiLocation { parents: 1, interior: X1(Parachain(2000)) }, xcm: Xcm([BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation { parents: 1, interior: X3(Parachain(1000), PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }, weight_limit: Limited(<wasm:stripped>) }, DepositAsset { assets: Wild(AllCounted(1)), beneficiary: MultiLocation { parents: 0, interior: X1(AccountId32 { network: None, id: [112, 97, 114, 97, 208, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }) } }]) }
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::currency_adapter: [Parachain] internal_transfer_asset asset: MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: X2(PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }, from: MultiLocation { parents: 0, interior: Here }, to: MultiLocation { parents: 1, interior: X1(Parachain(2000)) }
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::fungibles_adapter: [Parachain] internal_transfer_asset what: MultiAsset { id: Concrete(MultiLocation { parents: 0, interior: X2(PalletInstance(50), GeneralIndex(1984)) }), fun: Fungible(2200000) }, from: MultiLocation { parents: 0, interior: Here }, to: MultiLocation { parents: 1, interior: X1(Parachain(2000)) }
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::execute: [Parachain] !!! ERROR: FailedToTransactAsset("AccountIdConversionFailed")
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::execute_xcm_in_credit: [Parachain] result: Err(ExecutorError { index: 0, xcm_error: FailedToTransactAsset("AccountIdConversionFailed"), weight: <wasm:stripped> })
2023-08-11 11:47:42.038 TRACE tokio-runtime-worker xcm::execute_xcm_in_credit: [Parachain] Execution errored at 0: FailedToTransactAsset("AccountIdConversionFailed") (original_origin: MultiLocation { parents: 0, interior: Here })
As I understand the problem can be either in the from
or to
accounts used in the transfer call. So how should I form the request to transfer-reserve tokens from AssetHub to my parachain?
-lxcm=trace
. That will probably will give you the info you need to figure out the issue.