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

Accept block parameter wherever a query could internally happen #4

Open
MsRandom opened this issue Sep 20, 2024 · 1 comment
Open

Comments

@MsRandom
Copy link
Contributor

In several places, an internal function accepts a block parameter but the caller API function does not, some examples are:

  • metagraph.py: Metagraph.sync_nodes
  • weights.py: _min_interval_to_set_weights and _blocks_since_last_update

Reason:
Some validator setups cache the current block to avoid making too many requests to get it, and instead operate under a cached block for 12 second intervals(even if the block is outdated), but this is not possible if the option is not present in the user-facing APIs.

@fromancient
Copy link

I agree with the reasoning regarding the caching of the current block in validator setups. Caching helps to significantly reduce the number of requests made to the network, which can improve overall performance and reduce latency. By operating under a cached block for intervals of 12 seconds, validators can maintain a more stable and efficient operation, especially during peak times when network requests may be high.

However, it's important to note that this approach relies heavily on the availability of appropriate options in user-facing APIs. Without these options, validators may struggle to implement caching effectively, leading to potential inefficiencies and outdated information being used for decision-making. Therefore, enhancing user-facing APIs to support caching mechanisms would be crucial for optimizing validator performance and ensuring accurate, timely data is available for operations.

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

No branches or pull requests

2 participants