Skip to content

Test the ordinary residual sweep and fix the remaining scanner findings - #1897

Merged
KillariDev merged 5 commits into
mainfrom
t3/fix-solidity-scanner-coverage-findings
Dec 3, 2026
Merged

KillariDev merged 5 commits into
mainfrom
t3/fix-solidity-scanner-coverage-findings

Conversation

@KillariDev

@KillariDev KillariDev commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

What

Fixes the findings that the new checks of the unreachable Solidity code scanner (#1890) report on main. This PR is independent of #1890: it only fixes what the scanner found.

The scanner also reported SecurityPoolServices.flushBurn as never executed. Its burn queue had no writer, so it could only ever burn zero. #1895 removed that dead path while this PR was open, so this PR now only fixes the rest.

Ordinary residual sweep (never-executed)

No test reached the positive-surplus branch of settleOrdinaryGame, nor the success path of sweepResidualRepToQuestionLedger for an ordinary game.

Ordinary games burn the lowest outcome's stake as it arrives. That leaves custody holding the winner's stake plus the binding capital B. The winner reserve is floor(3B/5) + floor(2B/5) on top of the winner's stake, so the only surplus possible is a 1 atto-REP rounding residual, when B is not a multiple of 5.

A new test in ordinarySettlementRecovery.test.ts sets up exactly that case (B = 200 REP + 1). It checks that:

  • the sweep burns the 1 atto-REP and emits OrdinaryResidualRepBurned(1);
  • custody is left equal to the reserve;
  • a second sweep reverts;
  • the winner is still paid in full.

Named returns never assigned (unassigned-return)

Three empty test-stub question(...) functions named their state and finalClaim returns without assigning them. The names are dropped; behavior is unchanged.

Stale descriptions of the removed burn

  • The SecurityPoolServices @dev comment no longer says services burns unrecorded collateral. After Resolve below-Medium findings from the Dec 2 contract review (#1877) #1895 it burns nothing.
  • The contract inventory again says that settlement fees leave for a capital-ledger earnings payout or burn. The capital ledger's flushBurn() still withdraws them through withdrawCapitalCash(), but main's wording had narrowed this to payouts only.

Validation

…idual sweep

SecurityPoolServices kept pendingBurnCash, flushBurn and UnusedServiceCashBurned after #1865 removed the only
writer, so flushBurn could only ever burn zero. Remove them with their consumers. Test sweeping the one-atto-REP
rounding residual an ordinary game leaves when binding capital is not a multiple of the payout denominator,
the only path that reaches the residual burn. Stop naming never-assigned returns in three test stubs.
@KillariDev KillariDev changed the title Remove the never-filled services burn queue and test the ordinary residual sweep Test the ordinary residual sweep and fix the remaining scanner findings Dec 3, 2026
@KillariDev
KillariDev added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 223487d Dec 3, 2026
44 checks passed
@KillariDev
KillariDev deleted the t3/fix-solidity-scanner-coverage-findings branch December 3, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant