-
Notifications
You must be signed in to change notification settings - Fork 710
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
[remote-externalities] Batch calls scraping child-tree data #2245
Comments
polkadot-sdk/substrate/utils/frame/remote-externalities/src/lib.rs Lines 767 to 775 in ea4085a
polkadot-sdk/substrate/utils/frame/remote-externalities/src/lib.rs Lines 1239 to 1247 in ea4085a
|
Yes exactly
Add a test that scrapes live state similar to this: https://github.com/paritytech/polkadot-sdk/pull/1985/files#diff-f73dfe42c5919a5ebddb4df3294fea8e06d1b4dc0f0bba175a2c555223202cf5R1543-R1565 A remote with lots of child tries is |
So I am following the rabbit and it appears to be grabbing the child keys here: polkadot-sdk/substrate/utils/frame/remote-externalities/src/lib.rs Lines 800 to 802 in cfa19c3
polkadot-sdk/substrate/utils/frame/remote-externalities/src/lib.rs Lines 730 to 743 in cfa19c3
which calls the polkadot-sdk/substrate/client/rpc/src/state/mod.rs Lines 423 to 435 in cfa19c3
Two questions I have:
Put all the known keys into a vector and create a polkadot-sdk/substrate/client/rpc/src/state/mod.rs Lines 350 to 351 in cfa19c3
|
for prefixed_top_key in child_roots {
let child_keys =
Self::rpc_child_get_keys(&client, &prefixed_top_key, StorageKey(vec![]), at) They are in
ChatGPT is surprisingly good at answering these types of question https://chat.openai.com/share/b607012e-3f78-4bcd-9bdc-c6cac06646fd |
I have some code (#2584) and it compliles! Now I want to run the tests but when I run the tests locally or using
Do I need to be behind a VPN for the Polkadot RPC nodes to work? Locally, I am using the contracts node:
Same happens on |
What is the status of this @liamaharon @brunopgalvao ? |
I would very much like to continue working on this issue. I got an error here: #2245 (comment) I could use some help unblocking what could be the issue there. |
Does it with any of these nodes? https://gist.github.com/ggwpez/81db110fe4390ed9a7622f5857dfc4ff |
@brunopgalvao 429 means the server is rate limiting you. How many requests are you making in parallel? Limiting parallel requests and adding retry logic should resolve your issue. |
Yes. I have tried This is also happening on
@liamaharon I am getting this issue on |
I wasn't able to replicate @brunopgalvao, maybe due to my further distance to the servers compared to you. Can you try with this branch? https://github.com/paritytech/polkadot-sdk/tree/liam-remote-ext-exponential-backoff |
Got it to work! The
|
Ah nice catch. do you mind opening a pr to fix those tests? I would also be interested to know if my exponential backoff branch fixes the 429 errors :) |
429 errors no longer happen (including your branch) as long as the nodes have a However, as noted some tests use the polkadot-sdk/substrate/utils/frame/remote-externalities/src/lib.rs Lines 1507 to 1514 in b2c81b5
While other tests use the polkadot-sdk/substrate/utils/frame/remote-externalities/src/lib.rs Lines 1478 to 1486 in b2c81b5
The default for polkadot-sdk/substrate/utils/frame/remote-externalities/src/lib.rs Lines 256 to 259 in edd95b3
Does it make sense to refactor all tests to use |
Yes I think so, PR would be good :) |
PR: #3284 |
Refactor in accordance with #2245 (comment) Prior to this PR, the `remote_tests` test module would either use `TEST_WS` or `DEFAULT_HTTP_ENDPOINT`. With the PR, `TEST_WS` is the default for the `remote_tests` test module and the fallback is `DEFAULT_HTTP_ENDPOINT`. The only downside I see to this PR is that for particular tests in the `remote_tests` module, one would want to use a different http endpoint. If that is the case, they would have to manually hardcode the http endpoint for that particular test. Note: The `TEST_WS` node should fulfill the role for all test cases e.g. include child tries. Give it a _try_: ``` TEST_WS=wss://rococo-try-runtime-node.parity-chains.parity.io:443 cargo test --features=remote-test -p frame-remote-externalities -- --nocapture ``` --------- Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Refactor in accordance with paritytech#2245 (comment) Prior to this PR, the `remote_tests` test module would either use `TEST_WS` or `DEFAULT_HTTP_ENDPOINT`. With the PR, `TEST_WS` is the default for the `remote_tests` test module and the fallback is `DEFAULT_HTTP_ENDPOINT`. The only downside I see to this PR is that for particular tests in the `remote_tests` module, one would want to use a different http endpoint. If that is the case, they would have to manually hardcode the http endpoint for that particular test. Note: The `TEST_WS` node should fulfill the role for all test cases e.g. include child tries. Give it a _try_: ``` TEST_WS=wss://rococo-try-runtime-node.parity-chains.parity.io:443 cargo test --features=remote-test -p frame-remote-externalities -- --nocapture ``` --------- Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Child-tree data is currently fetched sequentially.
Most chains to date don't have that many child-trees so this hasn't been an issue, but the Rococo Contracts chain has almost 3000 child tries making this serial approach unnecessarily add a really long time to scraping keys.
The keys to scrape appear to all be known ahead of time, so we should be able to batch the requests.
This should be a pretty easy one. Good beginner issue with mentor available :)
The text was updated successfully, but these errors were encountered: