Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop when querying non-existing Runtime API with the Reconnecting Client #1903

Closed
pgherveou opened this issue Jan 24, 2025 · 7 comments · Fixed by #1904
Closed

Infinite loop when querying non-existing Runtime API with the Reconnecting Client #1903

pgherveou opened this issue Jan 24, 2025 · 7 comments · Fixed by #1904

Comments

@pgherveou
Copy link
Contributor

pgherveou commented Jan 24, 2025

We have this piece of code here that calls a runtime_api with subxt

https://github.com/paritytech/polkadot-sdk/blob/e9393a9afc3b33cc2d01b7820a8f186434196758/substrate/frame/revive/rpc/src/client.rs#L696-L703

When called for a block that pre-date this Runtime API, it looks like subxt enter in an infite loop

2025-01-24 10:00:02.145 TRACE tokio-runtime-worker jsonrpsee-client: send="{\"jsonrpc\":\"2.0\",\"id\":184,\"method\":\"state_call\",\"params\":[\"ReviveApi_block_gas_limit\",\"0x\",\"0x67f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9\"]}"
2025-01-24 10:00:02.179 TRACE tokio-runtime-worker jsonrpsee-client: send="{\"jsonrpc\":\"2.0\",\"id\":185,\"method\":\"state_call\",\"params\":[\"ReviveApi_block_gas_limit\",\"0x\",\"0x67f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9\"]}"
2025-01-24 10:00:02.211 TRACE tokio-runtime-worker jsonrpsee-client: send="{\"jsonrpc\":\"2.0\",\"id\":186,\"method\":\"state_call\",\"params\":[\"ReviveApi_block_gas_limit\",\"0x\",\"0x67f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9\"]}"
2025-01-24 10:00:02.244 TRACE tokio-runtime-worker jsonrpsee-client: send="{\"jsonrpc\":\"2.0\",\"id\":187,\"method\":\"state_call\",\"params\":[\"ReviveApi_block_gas_limit\",\"0x\",\"0x67f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9\"]}"
2025-01-24 10:00:02.278 TRACE tokio-runtime-worker jsonrpsee-client: send="{\"jsonrpc\":\"2.0\",\"id\":188,\"method\":\"state_call\",\"params\":[\"ReviveApi_block_gas_limit\",\"0x\",\"0x67f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9\"]}"
2025-01-24 10:00:02.322 TRACE tokio-runtime-worker jsonrpsee-client: send="{\"jsonrpc\":\"2.0\",\"id\":189,\"method\":\"state_call\",\"params\":[\"ReviveApi_block_gas_limit\",\"0x\",\"0x67f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9\"]}"

This can be tested with the following command from the polkadot-sdk repo

RUST_LOG="jsonrpsee=trace,subxt=trace,info,eth-rpc=debug" cargo run -p pallet-revive-eth-rpc -- --dev --node-rpc-url "wss://westend-asset-hub-rpc.polkadot.io"

Then hit the server with the following curl

curl --verbose  -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0",false],"id":43}' http://localhost:8545

The substrate node request return the expected response

curl https://westend-asset-hub-rpc.polkadot.io \
--header 'Content-Type: application/json' \
--data "{\"jsonrpc\":\"2.0\",\"id\":189,\"method\":\"state_call\",\"params\":[\"ReviveApi_block_gas_limit\",\"0x\",\"0x67f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9\"]}"


{
  "jsonrpc": "2.0",
  "id": 189,
  "error": {
    "code": 4003,
    "message": "Client error: Execution failed: Other: Exported method ReviveApi_block_gas_limit is not found"
  }
}
@pgherveou
Copy link
Contributor Author

Issue seems to be related to the fact that we are using the reconnecting client

@pgherveou pgherveou changed the title Infinite loop when querying Runtime API in old block Infinite loop when querying non-existing Runtime API with the Reconnecting Client Jan 24, 2025
@pgherveou
Copy link
Contributor Author

@jsdw
Copy link
Collaborator

jsdw commented Jan 24, 2025

Should be fixed by #1904

@nhussein11
Copy link

@pgherveou Does this need to be deployed to "wss://westend-asset-hub-rpc.polkadot.io"? I'm still encountering the same issue here

@jsdw
Copy link
Collaborator

jsdw commented Jan 24, 2025

@pgherveou Does this need to be deployed to "wss://westend-asset-hub-rpc.polkadot.io"? I'm still encountering the same issue here

We are doing a Subxt release shortly and then I expect @pgherveou can handle this side of it :)

@nhussein11
Copy link

Thanks, @jsdw! @pgherveou, could you please ping me when this is finished?

@jsdw
Copy link
Collaborator

jsdw commented Jan 28, 2025

Just FYI the 0.38.1 release was done so this should be unblocked from the Subxt side. Let us know if any issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants