Repository navigation
perf(watcher): read a vault only when it changed or an alert of it is due - #51
Open
frontendphil wants to merge 1 commit into
Open
frontendphil wants to merge 1 commit into
frontendphil wants to merge 1 commit into
Conversation
… due The network watcher read every vault in which something waited in each poll: about 16 to 23 requests a minute each, also when nothing changed for days, and for ever when a void request was left in the line. A vault changes only through its contracts, and they log each change. The search of each poll now reads every log (no topic filter) of each vault's Safe, Delay, Recovery Delay, cancel contract, Council Safe and the other addresses that can cancel. A vault is read when: - one of them logged something; - an alert that only time brings is due (nextAlertAt: a wait that ends, ends soon, void, the reminders before a recovery can be carried out); - its heartbeat is due, as before; - an hour went by while something waits in it (RECHECK_MS): the Delay removes void requests in skipExpired() without a log; - it is new, has alerts left to send or could not be read, as before. When the search did not reach the head (after an outage), every vault in which something waits is read in each poll, as before. The stand-in chain answers eth_getLogs as a node does now (one list, filtered by address, block and topics), and a request lands in a block of its own. A new test runs one sequence through a watcher that reads in each poll and through --all, and requires the same alerts at the same polls; it fails when the due times, the Safe's logs or the hourly read are taken out. 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 main fix from the RPC analysis. In production, 49 of the 77 requests a minute go to re-reading three vaults that haven't changed. Each vault with something waiting was re-read every minute: for days while a request waited, and forever when a void request was left in the queue.
When a vault is read now
A vault changes only through its contracts, and they log each change. The search in each poll now reads every log (no topic filter) of each vault's Safe, Delay, Recovery Delay, Roles modifier, Council Safe, and the other addresses that can cancel (a Council Safe that's deployed later is on the list before it exists). A vault is read when:
nextAlertAt): wait over, ends soon, void, the recovery reminders 7 days and 1 day beforeRECHECK_MS)Known limits
skipExpired()advancestxNoncewithout an event, so a "Removed" alert for a request that's already void can come up to an hour late. Its "void" alert itself is on time.eth_getLogscovers 20 vaults instead of 50.Tests (96 watcher tests pass,
tscand the build are clean)--all: two withdrawals, waits ending, an execution, a queued cooldown change, a request that ends soon, becomes void and is skipped without a log, the change executed, a cancel. Both must send the same alerts at the same polls. The test fails, at the step where it matters, when the due times, the Safe's logs, or the hourly recheck are removed.nextAlertAt(every time-based alert, and that a reminder that can no longer come doesn't keep a vault due every poll) and forwatchedBy(the wallet is never watched).eth_getLogsas a node does (one list, filtered by address, block and topics), and a new request lands in a block of its own. With the old source, all old tests pass on the new mock.test:fork:alertsandtest:fork:recovery-alerts(--allagainst the real contracts on a mainnet fork, including the time-based recovery alerts) pass locally.Expected effect: about 77 → about 25 requests a minute (the network searches, plus hourly rechecks and reads when something happens). Each additional vault with something waiting costs almost nothing. The
rpc:log line will show it.🤖 Generated with Claude Code