Reconcile against the real pool balance before freezing a checkpoint - #255
Merged
Conversation
RunOffchainReconciliation compares the oracle's books against themselves, so it passes whenever they are internally consistent, even when they disagree with the chain. It cannot see a reward credited for money that never arrived, nor money that arrived and was never allocated: both sides of its comparison move together. That was the only check gating checkpoint submission. The one that reads the real pool balance ran on a three hour timer and only once the oracle was caught up, so a root could be published while the books were already wrong, and with a quorum of one it would consolidate unopposed. Concretely, a subscriber whose forced payment arrives in a different amount than its paying tx states is classified wrong fee and banned, and the ETH is left unallocated. Bans are only reversible by governance, so publishing that state is expensive to undo. Run the onchain reconciliation before freezing, and refuse to freeze if it fails. It needs execution state at the processed block, which is why it was disabled: a non archival node cannot serve it during catch up. Point --execution-endpoint at a node that keeps state history. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 gap
RunOffchainReconciliationwas the only check gating checkpoint submission. It compares the oracle's books against themselves, so it passes whenever they are internally consistent — even when they disagree with the chain.It cannot detect:
In both cases liabilities and modelled assets move together, so it balances. It passed during the failed run on 2026-08-13, an hour before the real check found a 96,156,146,415,005,252 wei shortfall.
The check that reads the actual pool balance ran only on a 3-hour timer, and only once the oracle was caught up. So a root could be published while the books were already wrong — and with
quorum 1/1it consolidates unopposed.Why it matters concretely
A subscriber whose forced payment arrives in a different amount than its paying tx states is classified wrong-fee and banned, while the ETH sits unallocated. Bans are only reversible by governance, so publishing that state is expensive to undo.
Reconciliation would catch the accounting gap eventually — but potentially after the root was already on chain.
The change
Run
RunOnchainReconciliationbeforeFreezeCheckpoint, and refuse to freeze if it fails.Why it was disabled
The original comment reads:
// TODO: Temporally commented. Doesn't work well with non archival nodeIt needs execution state at the processed block, which a non-archival node cannot serve while the oracle is catching up — it fails with
missing trie node. That constraint is a deployment choice, not a property of the check: point--execution-endpointat a node that retains state history and it works. Verified against a reth archive node, where the equivalent query at an arbitrary historical block returns correctly.Cost
One balance read plus one
claimedBalancecall per withdrawal address, at each checkpoint only (every 28,800 slots ≈ 4 days). Measured at ~17s for 440 addresses.Note for operators
If your execution endpoint cannot serve state at
LatestProcessedBlock, the oracle will now stop at the checkpoint rather than publish an unverified root. That is the intended trade: refusing to decide beats deciding wrongly.🤖 Generated with Claude Code