8000 Make constructing XCM easier with PJS · Issue #11638 · polkadot-js/apps · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Make constructing XCM easier with PJS #11638
Open
@yrong

Description

@yrong

Context

Currently, when building XCM instructions, the order of the assets matters for multi-asset instructions like WithdrawAsset.

For example, when transfering WETH from AH to Ethereum, the XCM is constructed like this.

If you construct the XCM with the assets in reverse order using PJS, something like:

registry.createType("XcmVersionedXcm", {
        v5: [
            {
                withdrawAsset: unorderedAssets,
            },
            ...
       ]
})

An error like the following is raised when calling runtime API XcmPaymentApi::query_xcm_weight with the XCM.

Error: RpcError: 4003: Client error: Execution failed: Execution aborted due to trap: wasm trap: wasm `unreachable` instruction executed
WASM backtrace:
error while executing at wasm backtrace:
    0: 0x875918 - asset_hub_westend_runtime.wasm!rust_begin_unwind
    1: 0x74e13d - asset_hub_westend_runtime.wasm!core::panicking::panic_fmt::hed069c9d59ee9ac7
    2: 0x66997d - asset_hub_westend_runtime.wasm!XcmPaymentApi_query_xcm_weight
    at checkError (/Users/yangrong/Projects/snowbridge/web/node_modules/.pnpm/@polkadot+rpc-provider@15.10.2/node_modules/@polkadot/rpc-provider/cjs/coder/index.js:23:15)
    at RpcCoder.decodeResponse (/Users/yangrong/Projects/snowbridge/web/node_modules/.pnpm/@polkadot+rpc-provider@15.10.2/node_modules/@polkadot/rpc-provider/cjs/coder/index.js:39:9)
    at WsProvider.__internal__onSocketMessageResult (/Users/yangrong/Projects/snowbridge/web/node_modules/.pnpm/@polkadot+rpc-provider@15.10.2/node_modules/@polkadot/rpc-provider/cjs/ws/index.js:424:51)
    at WebSocket.__internal__onSocketMessage (/Users/yangrong/Projects/snowbridge/web/node_modules/.pnpm/@polkadot+rpc-provider@15.10.2/node_modules/@polkadot/rpc-provider/cjs/ws/index.js:413:20)
    at WebSocket.[nodejs.internal.kHybridDispatch] (/Users/yangrong/Projects/snowbridge/web/packages/operations/lib/internal/event_target.js:827:20)
    at WebSocket.dispatchEvent (/Users/yangrong/Projects/snowbridge/web/packages/operations/lib/internal/event_target.js:762:26)
    at fireEvent (/Users/yangrong/Projects/snowbridge/web/packages/operations/lib/internal/deps/undici/undici.js:11655:14)
    at websocketMessageReceived (/Users/yangrong/Projects/snowbridge/web/packages/operations/lib/internal/deps/undici/undici.js:11677:7)
    at ByteParser.run (/Users/yangrong/Projects/snowbridge/web/packages/operations/lib/internal/deps/undici/undici.js:12299:19)
    at ByteParser._write (node:internal/deps/undici/undici:12192:14) {stack: 'RpcError: 4003: Client error: Execution faile…e (node:internal/deps/undici/undici:12192:14)', code: 4003, data: undefined, message: '4003: Client error: Execution failed: Execut…_runtime.wasm!XcmPaymentApi_query_xcm_weight', name: 'RpcError'}
transfer_from_p2e_v3.ts:16
Process exited with code 1

Suggestions

  • Make the error more explictitly and meaningful when calling the runtime api XcmPaymentApi::query_xcm_weight with unordered assets.
  • Make the asset order irrelevant when building from PJS, e.g., is that possible to implement the sorting/deduplication logic in the frontend?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0