ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

Suggestion: remove default cache timeout

Open jxom opened this issue 4 months ago • 1 comments

Ethers Version

6

Describe the Problem

The default deduping timeout of 250ms could be dangerous as it could lead to mempool state sync issues, that can consequently lead to failure of actions (e.g. if a consumer depends on a eth_getTxCount(..., "pending") or other blockchain state that depends on the mempool/"pending".

I would recommend for the deduping timeout to be opt-in, or to disable this for block tags.

https://github.com/ethers-io/ethers.js/blob/main/src.ts/providers/abstract-provider.ts#L427

jxom avatar Sep 05 '25 02:09 jxom

I’ve been considering this for a while.

I think it makes sense to include along with the change of the ProviderOptions.staticNetwork to true (BrowserProvider will explicitly set this to false unless overridden).

I’ll queue it up for an upcoming minor bump and make an announcement on the ethers twitter.

ricmoo avatar Sep 05 '25 02:09 ricmoo