Skip to content

fully exhaust query map #144

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

Open
wants to merge 1 commit into
base: feat/thewhaleking/python-ss58-conversion
Choose a base branch
from

Conversation

thewhaleking
Copy link
Collaborator

Adds an arg to async substrate query map to fully exhaust the query map results rather than synchronously getting them by pagination.

In bigger tests such as SubtensorModule.OwnedHotkeys, the speed improvement is 5-6X faster.

@thewhaleking thewhaleking requested a review from a team June 27, 2025 16:19
@thewhaleking thewhaleking added the enhancement New feature or request label Jun 27, 2025
Copy link
Contributor

@basfroman basfroman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few questions

Comment on lines +188 to +190
@pytest.mark.asyncio
async def test_fully_exhaust_query_map():
async with AsyncSubstrateInterface(LATENT_LITE_ENTRYPOINT) as substrate:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to move this tests to e2e tests or mock connection and stub the results bc it's real call and we use a real server every commit in staging with this test.

Comment on lines +3517 to +3521
self.rpc_request(
method="state_queryStorageAt",
params=[batch_keys, block_hash],
runtime=runtime,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if one of the self.rpc_requests raises an error? For example, due to a short, temporary bad connection? Or a broken data structure?
You don't want to use return_exceptions=True for the gather and then filter the result? or use try except with logging in case of error?

@basfroman basfroman added run-bittensor-sdk-tests Runs Bittensor SDK tests. run-bittensor-cli-tests Runs BTCLI tests. labels Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request run-bittensor-cli-tests Runs BTCLI tests. run-bittensor-sdk-tests Runs Bittensor SDK tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants