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

feature: first draft timelag middleware #457

Merged
merged 6 commits into from
Sep 17, 2021
Merged

feature: first draft timelag middleware #457

merged 6 commits into from
Sep 17, 2021

Conversation

prestwich
Copy link
Collaborator

Provides a TimeLag middleware that offsets tip-related requests by a constant parameter K

e.g. TimelagMiddleware<M, 60> will modify eth_call, eth_getBlockNumber and other related parameters to use the current chain tip - 60 blocks

This provides a modicum of protection from reorgs

Please review

  • did I miss any requests that ought to be modified?
  • is the Unsupported behavior reasonable?
  • thoughts on the approach?
  • double-check normalization logic

ethers-middleware/src/timelag/mod.rs Outdated Show resolved Hide resolved
ethers-middleware/src/timelag/mod.rs Show resolved Hide resolved
ethers-middleware/src/timelag/mod.rs Outdated Show resolved Hide resolved
ethers-middleware/src/timelag/mod.rs Outdated Show resolved Hide resolved
ethers-middleware/src/timelag/mod.rs Outdated Show resolved Hide resolved
ethers-middleware/src/timelag/mod.rs Show resolved Hide resolved
ethers_providers::FilterWatcher<'_, Self::Provider, ethers_core::types::TxHash>,
Self::Error,
> {
Err(TimeLagError::Unsupported)
Copy link
Owner

Choose a reason for hiding this comment

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

I think Unsupported is fine, curious what others think

ethers-middleware/src/timelag/mod.rs Outdated Show resolved Hide resolved
@gakonst gakonst merged commit 57736ed into master Sep 17, 2021
@gakonst gakonst deleted the prestwich/timelag branch September 17, 2021 17:38
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

Successfully merging this pull request may close these issues.

2 participants