-
Notifications
You must be signed in to change notification settings - Fork 245
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
feat: set poll interval based on connected chain #767
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo this makes sense, and isn't very complex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach is a hard NACK from me
- Behavior is non-obvious. Users would not expect that calling an RPC method would change provider behavior
- Not all users will call
get_chain_id
, leading to different behavior in a hard-to-diagnose setting - The same program may not call
get_chain_id
on different runs, leading to inconsistent configuration for the same code
This could be done idiomatically by adding ProviderBuilder
methods to provide or fetch this at instantiation time
fn with_chain()
async fn fetch_chain()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like the approach, thanks :) couple quick questions in the review comments
* feat: set poll interval based on connected chain * Revert changes * feat: `ChainLayer` to set poll interval based on chain * use const fn
Motivation
Closes #604
Solution
Add
with_chain()
method toProviderBuilder
. TheChainLayer
will fetch the average block time for the chain and set client's poll intervalPR Checklist