You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Three high-severity issues from the Codex adversarial review on PR #2208,
each with a TDD regression test added first then fixed:
1. Header-race: signed announce arriving before header was silently
downgraded. handleSignedWitnessAnnouncements called peer.AddKnownAnnounce
unconditionally before the verification gate, leaving a peer marked
announce-known even on bad-signature / header-unknown rejection paths.
That suppressed our own re-relay back to that peer if a valid version
of the same hash arrived from someone else, killing the natural
recovery path. Fix: gate AddKnownAnnounce on acceptSignedAnnouncement
success so the announce-known bit only reflects verified delivery.
Test: TestHandleSignedWitnessAnnouncementsBadSigDoesNotMarkAnnounceKnown.
2. pendingWitnessBodies TTL didn't actually evict. get() observed expiry
and returned false but left the entry in the map; gcLocked only ran
from put(), so a node that stopped receiving witnesses retained up to
capacity (10) ~50MB blobs indefinitely. Fix: when get() observes an
expired entry, upgrade to write lock and delete it (re-checking under
the write lock to avoid clobbering a concurrent put).
Test: TestPendingWitnessBodyCacheGetEvictsExpired.
3. Honest body-server dropped on bad producer commitment.
verifyAgainstSignedHash dropped the byte-server on every signed-hash
mismatch, but the announcement only proves *some* BP signed *some*
hash — not that the hash matches the canonical witness. A faulty or
malicious scheduled producer that signed a bogus hash would weaponise
this to disconnect every honest peer serving the real witness. Fix:
reject the bytes (don't cache for serving) and back off the request
without dropping the byte-server. TODO comment left for follow-up
signer-quarantine work, which needs (signer, relayer) provenance the
manager doesn't currently have.
Test: TestProcessWitnessResponseDoesNotDropOnByteMismatch (replaces
the previous TestProcessWitnessResponseDropsOnHashMismatch, whose
policy this commit reverses).
0 commit comments