apps icon indicating copy to clipboard operation
apps copied to clipboard

`queryInfo` and `queryFeeDetails` of `transactionPaymentApi` Runtime API are broken in the developer tab

Open IkerAlus opened this issue 1 year ago • 2 comments

When querying any of the queryInfo and queryFeeDetails methods of the transactionPaymentApi Runtime API in any chain from the developer tab the following error is returned:

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: 0x9be8 - <unknown>!rust_begin_unwind 1: 0x319c - <unknown>!core::panicking::panic_fmt::hbb5a6b42001bdfec 2: 0x5730f1 - <unknown>!TransactionPaymentApi_query_fee_details

It seems that the new release of PJS API has introduced some changes in certain expected types for these queries on PJS apps.

We had a similar issue on API Sidecar and converting the extrinsic to u8a solved the issue.

  • [ X] Bug report
  • [ ] Feature request
  • [ ] Support request
  • [ ] Other
  • Please tell us about your environment:
  • Environment:

    • [ ] Node.js
    • [x ] Browser
    • [ ] Other (limited support for other environments)

IkerAlus avatar Oct 10 '24 09:10 IkerAlus

Yes, this is certainly an odd issue - I would of imagined the api underneath would accept any value and transform it as necessary but this seems to not be the case. This issue is probably related to: https://github.com/polkadot-js/api/releases/tag/v13.2.1

TarikGul avatar Oct 10 '24 13:10 TarikGul

The issue seems to appear when upgrading the api from 12.4.2 to 13.0.1.

In v12.4.2 if I call

await apiAt.call.transactionPaymentApi.queryInfo(extrinsic, extrinsic.length);

where extrinsic is a Hex string, it will return the fees with no issues.

As soon as I upgrade to v13.0.1 the same call returns a wasm panic error and I need to change it to

await apiAt.call.transactionPaymentApi.queryInfo(u8a, u8a.length);

where u8a is

 const ext = api.registry.createType('Extrinsic', extrinsic);
 const u8a = ext.toU8a();

to get the fees with no issues again.

What I noticed in apps is that for the same extrinsic, when it goes in OnSubmit and I check the value of the extrinsic submitted (values[0].value) it looks like apps converted the input extrinsic into Bytes type

api.registry.createType('Bytes', transaction);

and not into Extrinsic type like I did above. Maybe this is related to the error ?

The script that I used to debug the different versions of the api.

Imod7 avatar Oct 12 '24 16:10 Imod7

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

polkadot-js-bot avatar Jan 23 '25 17:01 polkadot-js-bot