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

Custom filter refresh interval #6

Open
alexeyinkin opened this issue Feb 24, 2022 · 0 comments
Open

Custom filter refresh interval #6

alexeyinkin opened this issue Feb 24, 2022 · 0 comments

Comments

@alexeyinkin
Copy link

Currently filters like eth_newPendingTransactionFilter refresh interval is hardcoded to be 2 seconds with _pingDuration constant in filters.dart. Then a timer is used with this interval. While 2 seconds may be enough for frontrunners on Ethereum with their long block, it is not enough for blockchains with shorter blocks and for backrunning on any blockchains.

I suggest to:

  1. Make an option to override this interval.
  2. Instead of a timer, use a loop with await Future.delayed().

Particularly, a loop solution would allow to not wait between calls for extreme extreme solutions.

For the interface we have the following options:

  1. Deprecate Web3Client.pendingTransactions and add a separate method with interval argument.
  2. Breaking change: Add a required argument to Web3Client.pendingTransactions since it is a very convenient name.
  3. Breaking change: Add an optional argument to Web3Client.pendingTransactions with the default of no waiting.
  4. Add an option to Web3Client to set all filters' intervals.

From the interface design point of view, (3) is the best, but it would change the behavior without breaking builds. So I suggest the roadmap:

  1. Do the Option 1 if we do this before the next breaking release.
  2. In the next breaking release, remove pendingTransactions.
  3. In yet the next breaking release do the Option 3.

Meanwhile another solution to refresh the filter at custom interval is to do

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

1 participant