-
Notifications
You must be signed in to change notification settings - Fork 2.6k
try-runtime: dynamic storage query sizes #13923
try-runtime: dynamic storage query sizes #13923
Conversation
…x-try-runtime-rpc-panic
Switching this to a draft and implementing a dynamic batch size as described here #13246 |
…x-try-runtime-rpc-panic
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
…h/substrate into liam-fix-try-runtime-rpc-panic
Confirmed these are working |
Hey @niklasad1, the polkadot staking-miner rpc expects that remote-externalities uses a WsClient: https://github.com/paritytech/polkadot/blob/5fd2bf8c9a0665b361eb26823030a5e0e65459b4/utils/staking-miner/src/rpc.rs#L108 Do you suggest that I refactor the staking-miner and open a companion PR, or try to modify this PR so that remote-externalities supports either a WsClient or HttpClient? |
I think it's fine to use the HTTP client just for the "batch requests/remote externalities" just change https://github.com/paritytech/polkadot/blob/master/utils/staking-miner/src/main.rs#L315-#L323 to take an URL instead (in case it would be a ws:// but you already added converting ws to http URL under the hood) |
bot merge |
Waiting for commit status. |
bot merge force |
* improve batch rpc error message * wip aimd storage data fetch * complete aimd function refactor * make batch_request function async * improve function name * fix load_child_remote issue * slight efficiency improvement * improve logs and variable name * remove redundant comment * improve comment * address pr comments * Update utils/frame/remote-externalities/src/lib.rs Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> * simplify client handling * fix type issue * fix clippy issue * try to trigger ci * try to trigger ci --------- Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
Closes #13246
polkadot companion: paritytech/polkadot#7111
Changes
get_storage_data_dynamic_batch_size
, allowing users to efficiently process a large amount of jsonrpc payloads without knowing the node max payload size configuration. The function calls itself recursively, increasingbatch_size
when the node responds successfully and reducing it when the node returns an error.get_storage_data_dynamic_batch_size
for fetching storage keys.jsonrpsee
library such as"961d622f: accumulated message length exceeds maximum"
and the node would also randomly refuse to continue servicing WsClient, returning incorrectly formatted errors (missing request IDs) that were also causing more internal errors inside thejsonrpsee
library. I'm not sure whether this issue is in thejsonrpsee
library or the way the Substrate RPC is configured or worth this is worth opening an issue to investigate, let me know if I should.rpc_child_get_keys
. It runs extremely fast on just one thread (2 seconds on a Macbook Pro), and the logic to run it across multiple threads was quite complex and causing some difficult to debug issues. I've benchmarked this to confirm negligible performance impact, I do not think parallelising this piece of code is worth it at this time.Notes
master
. Performance is identical (+/- <2% between runs)wss://rpc.polkadot.io:443
. it took 76min on my home internet, upload speed was be far the biggest bottleneck.