AcalaNetwork / chopsticks

Create parallel reality of your Substrate network.
Apache License 2.0
134 stars 80 forks source link

Invalid RPC request (Batch request) #444

Closed Tbaut closed 11 months ago

Tbaut commented 11 months ago

Chopsticks outputs an error for a batch request, as far as I understand. It seems that it may not support batch rpc calls? Here's the Chopsticks error, the payload contains 2 calls:

[17:06:10.486] INFO (ws/66001): Invalid request: [{"method":"state_getStorage","params":["0x26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7","0xfd5bbc6e2cd2221a2f608b51c63ca5e1f124a92980f7ab6eafd581c49d2b6c27"],"id":7,"jsonrpc":"2.0"},{"method":"state_getStorage","params":["0x26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7","0xe786b54466eb089a6c96f7d6849ecb5d2fc21ff03bd9e301887d5bef72d0b200"],"id":8,"jsonrpc":"2.0"}]

While the flow of requests is the following, notice the last call (7 and 8) contains 2 state_getStorage.

17:06:10 DEBUG sqd:processor:rpc rpc call
                                 rpcUrl: ws://localhost:8000
                                 rpcId: 6
                                 rpcMethod: chain_getBlock
                                 rpcParams: ["0xfd5bbc6e2cd2221a2f608b51c63ca5e1f124a92980f7ab6eafd581c49d2b6c27"]
17:06:10 DEBUG sqd:processor:rpc rpc send
                                 rpcUrl: ws://localhost:8000
                                 rpcId: 6
17:06:10 DEBUG sqd:processor:rpc rpc response
                                 rpcUrl: ws://localhost:8000
                                 rpcId: 6
                                 rpcMethod: chain_getBlock
                                 rpcParams: ["0xfd5bbc6e2cd2221a2f608b51c63ca5e1f124a92980f7ab6eafd581c49d2b6c27"]
                                 rpcResponse: {"id":6,"jsonrpc":"2.0","result":{"block":{"header":{"parentHash":"0xf3d14420002265fbc4e0884ab0ebde58bc76e7b26a7e28c7a2bd4603c060e5e3","number":7437969,"stateRoot":"0xb4f3461975cc0c145a6ccbfd904e9a431a147dc50cec68c709a50da6dc1bb239","extrinsicsRoot":"0x958ab035b01d8762759a42f7b8a012e5483f5d011d30c5668f11edf7156751db","digest":{"logs":[{"preRuntime":["0x42414245","0x031100000055cfdb1000000000caa97c339ef3ceb7c69b399817dcc1acc6f85ce06b9959ddb2d51c616d3380587634b6d7fb1ed20987d0ceda1cd6575de4fbdd332471a1e684cef511ef9f190d66a5b1b80c4ed7792fe12fa603f1eeb269c69feda7c1f3566972f4741b2d780e"]},{"consensus":["0x42454546","0x0388bbd6b4254ca820fe56941a2fd51d585cebd88ba18d9a48fed354d689eb255d"]},{"seal":["0x42414245","0xa6e8a0542c7cd3afa8087536bae0c87300cfc467c27c49cc262024cfaf93c40bbf6466cac6f1c1dd03bf69baafb4e470f6f8ea8c75686ab710a4b4f5d75cc489"]}]}},"extrinsics":["0x280402000b3158cb1f8b01","0x929901000436009901c0141000 [redacted as it is very large] c0c0e8519909ac9977c5c2aa76ee5058a420bd730f4519152df089"]},"justifications":null}}
17:06:10 DEBUG sqd:processor:rpc rpc call
                                 rpcUrl: ws://localhost:8000
                                 rpcId: 7
                                 rpcMethod: state_getStorage
                                 rpcParams: ["0x26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7","0xfd5bbc6e2cd2221a2f608b51c63ca5e1f124a92980f7ab6eafd581c49d2b6c27"]
17:06:10 DEBUG sqd:processor:rpc rpc call
                                 rpcUrl: ws://localhost:8000
                                 rpcId: 8
                                 rpcMethod: state_getStorage
                                 rpcParams: ["0x26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7","0xe786b54466eb089a6c96f7d6849ecb5d2fc21ff03bd9e301887d5bef72d0b200"]
17:06:10 DEBUG sqd:processor:rpc rpc send
                                 rpcUrl: ws://localhost:8000
                                 rpcBatchId: [7,8]
17:06:10 FATAL sqd:processor RpcProtocolError: Got response for unknown request null
                                 at WsConnection.handleResponse (/home/thib/Github/ChainSafe/multix/squid/node_modules/@subsquid/rpc-client/lib/transport/ws.js:110:19)

                                 code: 1008
ermalkaleci commented 11 months ago

yes batch is not supported

Tbaut commented 11 months ago

Thanks for the confirmation. Should I understand that this won't be supported any time in the near future, or is there a chance to bring this feature in? Asking so that I know how to organize my testing strategy.

xlc commented 11 months ago

It is not hard to implement. We can do it after current tasks.