Repository navigation
test(ant_pending): cover droppedFull and the explicit markObsolete* retire paths - #1054
Merged
Merged
Conversation
Contributor
|
@parthod0x LGTM, but you need change the target branch from |
…etire paths AntPendingSolutions had no coverage for two real on-chain paths: - The capacity fail-safe: when the pool is full and findFreeEntry() can reclaim nothing, add() must refuse and count droppedFull rather than overwrite a live entry. - The explicit retirements the publisher uses, markObsoleteGateRejected and markObsoleteParentGone. The existing tests only reach OBSOLETE implicitly via selection-time expiry, so the public retire methods, their stat counters, and the "OBSOLETE is not a duplicate" revival branch in add() reached from an explicit retire were all untested. Adds three tests built on the file's existing freshPool()/key()/ref() helpers: FullPoolRefusesAndCounts, ExplicitRetireIsCountedAndAllowsRevival, and ParentGoneRetireIsCountedSeparately. Test-only; no production code is touched.
parthod0x
force-pushed
the
test/ant-pending-coverage
branch
from
October 26, 2026 05:24
d80c43d to
fef7f53
Compare
Contributor
Author
|
Done — retargeted to |
cyber-pc
approved these changes
Oct 27, 2026
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.
What
Adds test coverage for two
AntPendingSolutionspaths that currently have none. Test-only — no production code is touched.Why
AntPendingSolutionsis how a node queues its computors' solutions for publication, and it had a live bug recently (#1024, fixed by #1025). Two real paths were still untested:1. The capacity fail-safe (
droppedFull). When the pool is full andfindFreeEntry()can reclaim no slot,add()must returnfalseand bumpdroppedFullrather than overwrite a live entry. Nothing in the suite filled the pool, so this was never exercised.2. The explicit retirements (
markObsoleteGateRejected/markObsoleteParentGone). The publisher retires entries through these. The existing tests only reachOBSOLETEimplicitly via selection-time expiry, so the public retire methods, their stat counters (obsoleteGateRejected/obsoleteParentGone), and the "OBSOLETE is not a duplicate" revival branch inadd()reached from an explicit retire were all untested. That revival branch is the exact logic next to the #1025 fix, so a regression there would silently strand a resubmitted solution.Tests added
Built on the file's existing
freshPool()/key()/ref()helpers:FullPoolRefusesAndCounts— fills toCAPACITY, asserts the nextadd()is refused anddroppedFull == 1.ExplicitRetireIsCountedAndAllowsRevival—markObsoleteGateRejectedis counted, stops selection, and a corrected resubmit on the same key revives the entry in place.ParentGoneRetireIsCountedSeparately—markObsoleteParentGoneincrements its own counter, distinct from the gate-rejected and expiry counters.Verification
Built and run on
x86_64-pc-windows-msvc(v143 toolset,/std:c++20, matching the test project): all 14TestAntColonyPendingtests pass — the 11 existing ones plus these 3. No K12-collision construction is needed, so this deliberately avoids the known-hard-to-test slot-recompute edge from #1024.