Repository navigation
A head we could not re-read is not a head that changed - #15
khalidsaidi wants to merge 1 commit into
Conversation
An unaccounted movement observed in a complete, successfully scanned history
could be reported as a CI deferral — a green build over real evidence.
main() returned 2 on `not history.canonical` before it had compared a single
observed transfer against the ledger, and two unlike causes both cleared that
flag:
* the fixed head's hash CHANGED — positive proof the snapshot's basis is
gone, so observations tied to it say nothing about the current chain
* the head could NOT BE READ — an outage, which says nothing at all about
what was already observed
Collapsing them meant a budget running out at the final identity check buried
a confirmed finding. That is issue #10 at a different gate: the run goes quiet
about evidence it already has because a later read failed. It is also the
defect @gjwang reported in the allowance handler, which this code fixed there
and reintroduced here.
The decision now happens after the observations exist and names the cause. A
changed head still returns 2 and says the basis was replaced. An unreadable
head with an observed violation returns 1 and says the re-read failed. An
unreadable head with nothing observed stays inconclusive, as it must.
Reproduced on ff43856 before the change; script/test_canonical_outage.py
fails three ways without it. Verified live against Base mainnet: a real
transfer removed from the ledger is still exit 1, the clean ledger still
passes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012mggwNhgEyvfn1q6Lrdk3Q
Codex Review Summary: ✅ CompletedThis 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: 32d8b3f49c
ℹ️ 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".
| if not history.canonical and unaccounted: | ||
| print(f"history not re-confirmed: {history.error}") | ||
| print("\nRESULT: FAIL — unaccounted movement observed in complete, " | ||
| "matching history; the head could not be re-read, which is an " | ||
| "outage and not a reason to withhold it.") | ||
| return 1 |
There was a problem hiding this comment.
Keep contradictory history separate from head-read outages
If an earlier page contains an unledgered movement and a later page raises HistoryConflict, derive_transfers() returns immediately with canonical=False and head_changed=False, retaining the earlier transfers. This branch now reports an accounting violation even though the history was explicitly invalidated, rather than returning 2 as before. This includes a log at the fixed head having a different block hash, not just duplicate-record conflicts. I reproduced exit 1 using an unledgered transfer in the first page and conflicting copies of one log in a later page. Preserve a distinct invalid-history outcome and exclude it from the outage-only failure path.
Useful? React with 👍 / 👎.
A confirmed unaccounted transfer could be reported as a successful CI deferral when the final identity check ran out of requests. Verification bug — no evidence of an actual unaccounted live transfer; the full scan on
mainis green.Cause.
main()returned 2 onnot history.canonicalbefore comparing any observed transfer against the ledger, and two unlike causes both cleared that flag:Collapsed together, a budget exhausted at the final head re-read buried a finding that was already in hand. This is issue #10's shape at a different gate, and the same defect @gjwang reported in the allowance handler — fixed there, reintroduced here.
Reproduction on
ff43856, unledgered transfer observed in a complete scan, head re-read failing as an outage:In CI, exit 2 is a warning and a green build.
After:
A genuine reorg is unchanged — still 2, now saying why:
Tests.
script/test_canonical_outage.pyfails three ways without the fix. The existing 25 history-scan tests pass either way — they cover a failed page and a changed head, but not an unreadable head holding an observed violation. gjwang'stest_head_change_invalidates_unconfirmed_observationsstill passes. 135 Python, 11 Solidity.Verified live against Base mainnet: a real transfer removed from the ledger is still exit 1; the real ledger still passes.
🤖 Generated with Claude Code
https://claude.ai/code/session_012mggwNhgEyvfn1q6Lrdk3Q