Repository navigation
feat(watcher): count the RPC requests of each poll - #46
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
frontendphil
added a commit
that referenced
this pull request
Nov 27, 2026
…hole chain (#47) * test(fork): hint the creation block, so the fork never searches the whole chain Without a block hint, inspect() reads the logs of a Roles modifier from block 0. On a fork, anvil forwards the part before the fork block to the forked RPC, which then searches the whole of mainnet for an address that exists only on the fork: 3 to 8 seconds for each new Chronobox, and much more when the public gateway is slow (test:fork took 5m25s on #46). The fork tests now pass a hint: everything they make comes after the head at their start. A wrong hint cannot hide a history (the app reads again from block 0 when the start is missing), and fork.ts still checks that fallback with a hint that is too late. Locally, from a cold fork: test:fork 65s -> 18s, guardian 39s -> 12s, deposit 22s -> 10s, alerts 9s -> 6s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(fork): answer the pre-fork part of the block-0 reads locally The two pauses in test:fork were the reads from block 0 that stayed on purpose: - 9b: without logs, the app searches the deploy block with eth_getCode at old blocks (21 upstream requests), and a hint that is too late makes it read the history again from block 0 (one whole-chain search). - 10a: its hints returned null, though the step only needs a chainId. 10a now uses the fork's hint. 9b reads through madeAfter(): for the Roles modifier that the test made on the fork, it answers the part before the fork itself (no code, no logs) instead of anvil asking the forked RPC. The app sends the same requests, and 9b now also checks that the history was read from the remembered block and then from block 0. test:fork from a cold fork: 18s -> 16s, and no eth_getLogs goes upstream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Each poll logs one line with its requests to the RPC, split into the
search (scan and new Delays) and the reads of the vaults, by method:
rpc: 23 requests (search 5, 1 Chronobox read 18): eth_call 12, ...
The poll result (and the last-poll note in Redis) carries the totals as
`rpc: { scan, vaults, read }`. /api/health is unchanged.
This measures where the RPC load comes from before we reduce it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
frontendphil
force-pushed
the
rpc-call-counter
branch
from
November 27, 2026 11:59
e65c4fe to
adae840
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The RPC load has grown with the first test users. Before changing how the watcher polls, this measures where the requests go.
What it does
Rpccan count its requests by method. Every try counts, including a failed one that falls back to the next endpoint, since each try is a request the provider sees.--allpoll counts the search (network scan and checks of new Delays) apart from the vault reads, and logs one line:rpc: 23 requests (search 5, 1 Chronobox read 18): eth_call 12, eth_getLogs 3, eth_blockNumber 2, …last-pollnote in Redis, carriesrpc: { scan, vaults, read }per network./api/healthis public and unchanged.What to look for after deploy: whether
vaultsgrows with the number of vaults that have something waiting (the suspected cause: each one is re-read in full every minute, about 30 requests per read with a guardian).Tests: a new service test checks that
scan + vaultsmatches exactly the requests the mock RPC received, and that the log line matches. All 91 watcher tests pass, andtscand the build are clean.🤖 Generated with Claude Code