This repository was archived by the owner on Oct 16, 2025. It is now read-only.
fix: ensure middleware uses latest block number#416
Merged
Conversation
jiexi
commented
Oct 8, 2025
Gudahtt
reviewed
Oct 9, 2025
Gudahtt
reviewed
Oct 9, 2025
Gudahtt
reviewed
Oct 9, 2025
CHANGELOG.md
Outdated
| ### Changed | ||
|
|
||
| - Bump `@metamask/eth-block-tracker` from `^12.0.0` to `^12.2.0` ([#404](https://github.com/MetaMask/eth-json-rpc-middleware/pull/413)) | ||
| - Change all `PollingBlockTracker.getLatestBlock()` calls to include `useCache: true` ([#416](https://github.com/MetaMask/eth-json-rpc-middleware/pull/416)) |
Member
There was a problem hiding this comment.
Is this meant to be indented under the bump entry?
Suggested change
| - Change all `PollingBlockTracker.getLatestBlock()` calls to include `useCache: true` ([#416](https://github.com/MetaMask/eth-json-rpc-middleware/pull/416)) | |
| - Change all `PollingBlockTracker.getLatestBlock()` calls to include `useCache: true` ([#416](https://github.com/MetaMask/eth-json-rpc-middleware/pull/416)) |
Member
Author
There was a problem hiding this comment.
yeah, but we make it a root level item if you don't think there's value making a sub item
Member
Author
There was a problem hiding this comment.
also i think the links for the changelogs are wrong. #404 vs link to 413
Member
There was a problem hiding this comment.
Good catch, I can fix that change entry mistake separately.
I was thinking this should be a top-level entry because it's not really related to the dependency bump
Member
Author
There was a problem hiding this comment.
unindented and moved to the bottom of the changes c939a8c
Gudahtt
pushed a commit
that referenced
this pull request
Oct 15, 2025
This reverts commit 65e0b97. <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? Are there any issues or other links reviewers should consult to understand this pull request better? For instance: * Fixes #12345 * See: #67890 --> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Remove `useCache: false` from `PollingBlockTracker.getLatestBlock()` calls across middlewares; update changelog and raise Jest coverage thresholds. > > - **Middleware**: > - Remove `useCache: false` from `PollingBlockTracker.getLatestBlock()` in `src/block-cache.ts`, `src/block-ref-rewrite.ts`, `src/block-ref.ts`, and `src/retryOnEmpty.ts`. > - **Changelog**: > - Add Unreleased “Fixed” note about preventing request delays and reverting `#416`. > - **Testing**: > - Increase Jest global coverage thresholds (`branches`, `functions`, `lines`, `statements`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2edc83d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sets
useCache: falseoption forPollingBlockTracker.getLatestBlock()to ensure that an up-to-date block number is retrieved. Previously it was possible to only get out-of-date block numbers if thePollingBlockTrackerwas no longer pollingSee: https://github.com/MetaMask/eth-block-tracker/pull/340/files
See: https://consensyssoftware.atlassian.net/browse/NWNT-615
Note
Update middleware to call
blockTracker.getLatestBlock({ useCache: false })and bump deps to@metamask/eth-block-tracker@^12.2.0and@metamask/eth-json-rpc-provider@^5.0.0.blockTracker.getLatestBlock({ useCache: false })insrc/block-cache.ts,src/block-ref-rewrite.ts,src/block-ref.ts, andsrc/retryOnEmpty.tsto ensure fresh block numbers.@metamask/eth-block-trackerto^12.2.0and@metamask/eth-json-rpc-providerto^5.0.0(and related transitive updates inyarn.lock).ethersProviderAsMiddleware.Written by Cursor Bugbot for commit 6bc0146. This will update automatically on new commits. Configure here.