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
The issue appears to be a type ChainAsset<T, I> which is an alias for a chain-specific enum of assets. (See 'asset' in Governance.propose_governance_extrinsic extrinsic in the Chainflip block explorer).
For example, there is an Ethereum instance of ChainAsset that resolves to an eth::Asset: enum Asset { Eth, Flip, Usdc, Usdt }. Another instance resolves to a btc::Asset: enum Asset { Btc }.
The problem seems to be that polkaJS is trying to resolve an encoded eth::Asset::Usdt to a btc::Asset. Since btc::Asset only has one variant, the decoding fails.
I'm not sure if the source of the issue is indeed polkaJS, or scale metadata, or a combination of the two.
I'm also not sure if this can be mitigated or avoided by declaring our substrate types a bit differently.
Any advice would be welcome.
What is the motivation for changing the behavior?
The encoding is correct, and is compatible with substrate / metadata. We use similar patterns elsewhere - this seems like something that polkaJs should be able to handle.
Some tools seem to be able to correctly decode this type using the metadata. For example, subxt codegen correctly disambiguates the types.
Please tell us about your environment:
Version:
Environment:
Node.js
Browser
Other (limited support for other environments)
Language:
JavaScript
TypeScript (include tsc --version)
Other
The text was updated successfully, but these errors were encountered:
Current behaviour: polkaJS is unable to decode this Chainflip block:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fmainnet-archive.chainflip.io#/explorer/query/0xf7d516bd72ee1d76903e692157fc2a5260788faa6c9b6a369c3006b19413b6d2
Blocks before and after decode fine (2053085 is the block height of the failing block).
The Chainflip block explorer can decode the block:
https://scan.chainflip.io/blocks/2053085
The issue appears to be a type
ChainAsset<T, I>
which is an alias for a chain-specific enum of assets. (See 'asset' in Governance.propose_governance_extrinsic extrinsic in the Chainflip block explorer).For example, there is an Ethereum instance of ChainAsset that resolves to an eth::Asset:
enum Asset { Eth, Flip, Usdc, Usdt }
. Another instance resolves to a btc::Asset:enum Asset { Btc }
.The problem seems to be that polkaJS is trying to resolve an encoded eth::Asset::Usdt to a btc::Asset. Since btc::Asset only has one variant, the decoding fails.
I'm not sure if the source of the issue is indeed polkaJS, or scale metadata, or a combination of the two.
I'm also not sure if this can be mitigated or avoided by declaring our substrate types a bit differently.
Any advice would be welcome.
The encoding is correct, and is compatible with substrate / metadata. We use similar patterns elsewhere - this seems like something that polkaJs should be able to handle.
Some tools seem to be able to correctly decode this type using the metadata. For example, subxt codegen correctly disambiguates the types.
Version:
Environment:
Language:
The text was updated successfully, but these errors were encountered: