Repository navigation
perf(watcher): reuse the poll's chain data and proxy cache in every vault read - #49
Merged
Merged
Conversation
…ault read Each vault read asked the RPC again for the chain id, the head block and its timestamp, which the search of the poll had just read, and started with an empty cache of the Delay and Roles proxies. In production that was 3 to 5 of the 16 to 23 requests of each read, every minute. - The search hands its chain id, head and head timestamp to the reads of the vaults: one head for the whole poll. - The proxy cache belongs to the network watcher and lives across reads and polls. Proxy code does not change; "other" is still never cached. - A vault that a question of the bot read at a later block than the poll's head reads the head itself, so its state never goes back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 counter from #46 shows 86 RPC requests a minute in production: 24 for the network searches and 62 for re-reading 3 vaults (16 per read on Ethereum, 23 on Gnosis). This is the quick win from that analysis.
What changes
eth_chainId,eth_blockNumberand the head block. It now hands them to the vault reads, which no longer ask again. That's 3 requests less per vault read.proxyKinds(is this address a Delay or Roles proxy?) moves to theAllWatcherand is kept across reads and polls, so theeth_getCodecalls for known modules happen once. Proxy code never changes. Addresses that are not a proxy yet (for example a Recovery Delay that wasn't deployed) are still never cached.Trade-off: all vault reads in a poll use the head from the start of the poll, at most about 60s old (
POLL_BUDGET_SECONDS). Every read is still pinned to one block, so it stays consistent, and the next poll covers everything after that block.Expected effect: vault reads should drop from 16/23 to about 11–13/18–20 requests. The
rpc:log line will show the real numbers in the first polls after deploy.Tests: 92 watcher tests pass,
tscand the build are clean.eth_chainIdandeth_blockNumberonce each.🤖 Generated with Claude Code