paritytech / substrate-api-sidecar

REST service that makes it easy to interact with blockchain nodes built using Substrate's FRAME framework.
https://paritytech.github.io/substrate-api-sidecar/dist/
GNU General Public License v3.0
247 stars 152 forks source link

Sidecar API generate error on tx fee estimation #1504

Closed maestroi closed 1 month ago

maestroi commented 1 month ago

Description

Sidecar API version: v19.2.0 Polkadot version: 1.15.2 and 1.16.0

when trying to fetch a specifc tx: {"tx":"0x59028400d172a74cda4c865912c32ba0a80a57ae69abae410e5ccb59dee84e2f4432db4f00411581e00421c087e27123c781bf9c287aae4a3b58f649d31fb3b587094c9bfc99e65ed1e91ca2bfa7e1c2f8e95e2cbdff29fa16bd092c8b2bb39be3ca696b0d00040208af2f000503005665ef9894f68738853586822941e372b30a1e621bda3f5698effd4a5e581f31137cf0010c343237a8"}

request

curl --location --request POST 'https://polkadot.node.com/transaction/fee-estimate' \
--header 'Authorization: Bearer xxx' \
--header 'Content-Type: application/json' \
--data-raw '{"tx":"0x59028400d172a74cda4c865912c32ba0a80a57ae69abae410e5ccb59dee84e2f4432db4f00411581e00421c087e27123c781bf9c287aae4a3b58f649d31fb3b587094c9bfc99e65ed1e91ca2bfa7e1c2f8e95e2cbdff29fa16bd092c8b2bb39be3ca696b0d00040208af2f000503005665ef9894f68738853586822941e372b30a1e621bda3f5698effd4a5e581f31137cf0010c343237a8"}'

Error It will generate a error: 2024-10-08 12:22:18 error: RPC-CORE: call(method: Text, data: Bytes, at?: BlockHash): Bytes:: 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: 0x572c0a - <unknown>!TransactionPaymentApi_query_info 2024-10-08 12:22:18 error: Unable to fetch fee info Cause: 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: 0x572c0a - <unknown>!TransactionPaymentApi_query_info Transaction: 0x59028400d172a74cda4c865912c32ba0a80a57ae69abae410e5ccb59dee84e2f4432db4f00411581e00421c087e27123c781bf9c287aae4a3b58f649d31fb3b587094c9bfc99e65ed1e91ca2bfa7e1c2f8e95e2cbdff29fa16bd092c8b2bb39be3ca696b0d00040208af2f000503005665ef9894f68738853586822941e372b30a1e621bda3f5698effd4a5e581f31137cf0010c343237a8 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: 0x9be8 - <unknown>!rust_begin_unwind 1: 0x319c - <unknown>!core::panicking::panic_fmt::hbb5a6b42001bdfec 2: 0x572c0a - <unknown>!TransactionPaymentApi_query_info at checkError (/usr/src/app/node_modules/@polkadot/rpc-provider/cjs/coder/index.js:23:15) at RpcCoder.decodeResponse (/usr/src/app/node_modules/@polkadot/rpc-provider/cjs/coder/index.js:39:9) at WsProvider.__internal__onSocketMessageResult (/usr/src/app/node_modules/@polkadot/rpc-provider/cjs/ws/index.js:413:51) at WebSocket.__internal__onSocketMessage (/usr/src/app/node_modules/@polkadot/rpc-provider/cjs/ws/index.js:402:20) at callListener (/usr/src/app/node_modules/ws/lib/event-target.js:290:14) at WebSocket.onMessage (/usr/src/app/node_modules/ws/lib/event-target.js:209:9) at WebSocket.emit (node:events:519:28) at Receiver.receiverOnMessage (/usr/src/app/node_modules/ws/lib/websocket.js:1220:20) at Receiver.emit (node:events:519:28) at Receiver.dataMessage (/usr/src/app/node_modules/ws/lib/receiver.js:596:14) 2024-10-08 12:22:18 warn: POST /transaction/fee-estimate?auth= 400 36ms

Rollback to v19.1.0 will solve the problem

Steps to Reproduce

curl --location --request POST 'https://polkadot.node.com/transaction/fee-estimate' \
--header 'Authorization: Bearer xxx' \
--header 'Content-Type: application/json' \
--data-raw '{"tx":"0x59028400d172a74cda4c865912c32ba0a80a57ae69abae410e5ccb59dee84e2f4432db4f00411581e00421c087e27123c781bf9c287aae4a3b58f649d31fb3b587094c9bfc99e65ed1e91ca2bfa7e1c2f8e95e2cbdff29fa16bd092c8b2bb39be3ca696b0d00040208af2f000503005665ef9894f68738853586822941e372b30a1e621bda3f5698effd4a5e581f31137cf0010c343237a8"}'```

**Expected vs. Actual Behavior**

following response expected
```{
    "weight": {
        "refTime": "145570000",
        "proofSize": "3593"
    },
    "class": "Normal",
    "partialFee": "163154905"
}

Actual behavior.

It will generate a error:
`2024-10-08 12:22:18 error: RPC-CORE: call(method: Text, data: Bytes, at?: BlockHash): Bytes:: 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: 0x572c0a - <unknown>!TransactionPaymentApi_query_info
2024-10-08 12:22:18 error: Unable to fetch fee info
 Cause: 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: 0x572c0a - <unknown>!TransactionPaymentApi_query_info
 Transaction: 0x59028400d172a74cda4c865912c32ba0a80a57ae69abae410e5ccb59dee84e2f4432db4f00411581e00421c087e27123c781bf9c287aae4a3b58f649d31fb3b587094c9bfc99e65ed1e91ca2bfa7e1c2f8e95e2cbdff29fa16bd092c8b2bb39be3ca696b0d00040208af2f000503005665ef9894f68738853586822941e372b30a1e621bda3f5698effd4a5e581f31137cf0010c343237a8
 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: 0x9be8 - <unknown>!rust_begin_unwind
    1: 0x319c - <unknown>!core::panicking::panic_fmt::hbb5a6b42001bdfec
    2: 0x572c0a - <unknown>!TransactionPaymentApi_query_info
    at checkError (/usr/src/app/node_modules/@polkadot/rpc-provider/cjs/coder/index.js:23:15)
    at RpcCoder.decodeResponse (/usr/src/app/node_modules/@polkadot/rpc-provider/cjs/coder/index.js:39:9)
    at WsProvider.__internal__onSocketMessageResult (/usr/src/app/node_modules/@polkadot/rpc-provider/cjs/ws/index.js:413:51)
    at WebSocket.__internal__onSocketMessage (/usr/src/app/node_modules/@polkadot/rpc-provider/cjs/ws/index.js:402:20)
    at callListener (/usr/src/app/node_modules/ws/lib/event-target.js:290:14)
    at WebSocket.onMessage (/usr/src/app/node_modules/ws/lib/event-target.js:209:9)
    at WebSocket.emit (node:events:519:28)
    at Receiver.receiverOnMessage (/usr/src/app/node_modules/ws/lib/websocket.js:1220:20)
    at Receiver.emit (node:events:519:28)
    at Receiver.dataMessage (/usr/src/app/node_modules/ws/lib/receiver.js:596:14)
2024-10-08 12:22:18 warn: POST /transaction/fee-estimate?auth= 400 36ms
Imod7 commented 1 month ago

Thank you @maestroi for submitting the issue. I am checking now and get back to you asap.

Imod7 commented 1 month ago

@maestroi A fix for this issue was merged just now (related PR) and tomorrow I will do a patch release in Sidecar. If you would like to have the fix right now though, you can pull the master branch and rebuild. Otherwise, I will update this issue again tomorrow as soon as the release is out.

maestroi commented 1 month ago

Thank you very much!

Imod7 commented 1 month ago

@maestroi Closing this issue since a new patch release for Sidecar was published, v19.2.1 (npm). Feel free to re-open it if you encounter another error in fee-estimate endpoint or open a different issue. Thank you again for reporting this!