Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants