Repository navigation
fix: limit default watchBlocks catch-up to 100 blocks - #5381
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: d0743d9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 017ecb6324
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pollingInterval > blockTime / 2) | ||
| // The default catches up at most 100 blocks, so a long gap, such as a | ||
| // device waking from sleep, skips to the latest block. | ||
| const maxMissed = emitMissed_ === undefined ? 100 : Number.POSITIVE_INFINITY |
There was a problem hiding this comment.
Include the catch-up cap in the observer key
When one watcher relies on the default emitMissed value and another explicitly sets emitMissed: true on the same client, both compute emitMissed === true and therefore share the same observer ID. Because observe runs only the first watcher's polling function, the explicit watcher can incorrectly inherit the 100-block cap, or the default watcher can inherit unlimited catch-up, depending on registration order. Include maxMissed or the explicit/default distinction in the observer key so these different behaviors cannot be deduplicated.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in d0743d9: maxMissed is now part of the observer key, with a test that runs a default watcher beside an explicit emitMissed: true one.
|
Published pnpm add viem@pr-5381
pnpm add viem@0.0.0-pr-5381-d0743d9 |
Limits the default
emitMissedcatch-up inwatchBlocksto 100 blocks. After a longer gap, such as a device waking from sleep, it emits only the latest block. An explicitemitMissed: truestill emits every block.Follows #5380, which turned
emitMissedon by default on fast chains. On Arbitrum, one hour of sleep queued about 14,400getBlockcalls before the latest block.