You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Struct: failed on assetId: Option<MultiLocationV3>:: decodeU8aStruct: failed at 0x010300a10f043205e514… on interior (index 2/2): {"_enum":{"Here":"Null","X1":"JunctionV3","X2":"(JunctionV3,JunctionV3)","X3":"(JunctionV3,JunctionV3,JunctionV3)","X4":"(JunctionV3,JunctionV3,JunctionV3,JunctionV3)","X5":"(JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3)","X6":"(JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3)","X7":"(JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3)","X8":"(JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3,JunctionV3)"}}:: decodeU8aStruct: failed at 0xa10f043205e514… on key (index 2/2): [u8;20]:: Expected input with 20 bytes (160 bits), found 7 bytes
In the above error it expects AccountKey20 (derived from [u8;20]). The index of this is 3 in JunctionV3. The assetId hex string always starts with 0x0103, in which 0x01 is used for parent: 1 and 0x03 should be used for X3 of JunctionsV3. However, the 0x03 occurs to be used not only for JunctionsV3 but also for the first entry into the tuple of X3, which is JunctionV3. So, it seems to be like a mistaken overlap for the decode functionality.
I want to use the following assetId (which is USDC on AssetHub for our Zeitgeist Parachain):
letparentsNumber=api.registry.createType('u8',1);letparachainCompactNumber=api.registry.createType('Compact<u32>',1000);// let parachain = api.registry.createType('JunctionV3', { Parachain: parachainCompactNumber });letpalletInstanceNumber=api.registry.createType('u8',50);// let palletInstance = api.registry.createType('JunctionV3', { PalletInstance: palletInstanceNumber });letgeneralIndexNumber=api.registry.createType('Compact<u128>',1337);// let generalIndex = api.registry.createType('JunctionV3', { GeneralIndex: generalIndexNumber });letassetId=api.registry.createType('TAssetConversion',{// eslint-disable-next-line sort-keys// 0x010300a10f043205e514 (parachain, palletInstance, generalIndex) [1,1,3,0,161,15,4,50,5,229,20]// 0x010305e51400a10f0432 (generalIndex, parachain, palletInstance) [1,1,3,5,229,20,0,161,15,4,50]// 0x010300a10f05e5140432 (parachain, generalindex, palletInstance) [1,1,3,0,161,15,5,229,20,4,50]// 0x0103043200a10f05e514 (palletInstance, parachain, generalIndex) [1,1,3,4,50,0,161,15,5,229,20]// 0x0103043205e51400a10f (palletInstance, generalIndex, parachain) [1,1,3,4,50,5,229,20,0,161,15]// 0x010305e514043200a10f (generalindex, palletInstance, parachain) [1,1,3,5,229,20,4,50,0,161,15]// parents: 0x01 or [1,1]// interior x3: 0x03 or [3]// generalIndex: 0x05e514 or [5,229,20]; the 5 is the index of JunctionV3 enum// palletInstance: 0x0432 or [4,50]; the 4 is the index of JunctionV3 enum; 50 is the palletInstance number// parachain: 0x0a10f or [0,161,15]; the 0 is the index of JunctionV3 enumparents: parentsNumber,interior: {x3: [{parachain: parachainCompactNumber},{palletInstance: palletInstanceNumber},{generalIndex: generalIndexNumber},],},});
Here is some useful debug output of @polkadot/types-codec:
Btw. I used a local fork of @polkadot/api and @polkadot/known-types to override the TAssetConversion for zeitgeist to be Option<MultiLocationV3>.
The text was updated successfully, but these errors were encountered:
I'll move this to @polkadot/extension-dapp, because as soon as I sign with the extension, it wouldn't work. The asset id input for the polkadot api however is fine.
Unfortunately, #5968 adds the Option to the hex asset id payload. This results in the asset id to include the option in the string through toPayload() for the signature here. So instead of asset id hex 0x010300a10f043205e514 it is then 0x01010300a10f043205e514, which then results in a decoding error somewhere down the line.
Chralt98
changed the title
Decode overlaps "X3" with enum variant number of "JunctionV3"
Decode of assetId hex string fails for signed payload because of OptionJan 24, 2025
In the above error it expects
AccountKey20
(derived from[u8;20]
). The index of this is3
inJunctionV3
. TheassetId
hex string always starts with0x0103
, in which0x01
is used forparent: 1
and0x03
should be used forX3
ofJunctionsV3
. However, the0x03
occurs to be used not only forJunctionsV3
but also for the first entry into the tuple ofX3
, which isJunctionV3
. So, it seems to be like a mistaken overlap for the decode functionality.I want to use the following
assetId
(which isUSDC
on AssetHub for our Zeitgeist Parachain):Here is some useful debug output of
@polkadot/types-codec
:Btw. I used a local fork of
@polkadot/api
and@polkadot/known-types
to override theTAssetConversion
forzeitgeist
to beOption<MultiLocationV3>
.The text was updated successfully, but these errors were encountered: