Skip to content

test: cover the untested error-paths - #632

Closed
yggdrasilworld wants to merge 3 commits into
MergeFi:mainfrom
yggdrasilworld:test/error-path-coverage
Closed

yggdrasilworld wants to merge 3 commits into
MergeFi:mainfrom
yggdrasilworld:test/error-path-coverage

Conversation

@yggdrasilworld

@yggdrasilworld yggdrasilworld commented Oct 14, 2026 •

Copy link
Copy Markdown

What

Tests for the error-paths that were genuinely reachable but uncovered:

Honest note on #517/#520/#523/#524

The ArithmeticOverflow + DepositCountOverflow checked_add paths are defensive — the token's i128 supply bounds escrow.amount/contribution.amount/deposit-count, so a caller can't push them past overflow through the public API. No honest test can trigger them; flagged rather than writing a fake one.

Resolves #516 #518 #519 #521 #522 #525 (the triggerable error-paths)

Payment: Base USDC 0xD40Df5c27cEa7dd78A3c345401995c319589334e

… were frozen

A pause() was meant to block NEW risky ops (allocate/release/contribute)
but keep recovery paths open — its own doc says so. deallocate was pause-
blocked though, so during a pause a sponsor couldn't un-allocate funds back
to remaining_budget (or refund on a closed milestone) — allocated funds
were frozen. Deallocate is a recovery path; it no longer checks is_paused.

Resolves MergeFi#530

Tests: updated test_deallocate_blocked_while_paused + the pause-coverage
test to assert the recovery-path semantics. Note: couldn't run cargo test —
the workspace needs rustc 1.95 (installed: 1.92); CI verifies.
- escrow MergeFi#516: initialize rejects treasury == contract (InvalidTreasury)
- milestones MergeFi#518: same InvalidTreasury; MergeFi#519: deallocate an unallocated
  issue (IssueNotAllocatedForDeallocate); MergeFi#525: get_oracle returns the
  configured oracle
- maintenance-pool MergeFi#521: InvalidTreasury; MergeFi#522: reclaim_deposit rejects a
  different sponsor (NotDepositSponsor)

Note on MergeFi#517/MergeFi#520/MergeFi#523/MergeFi#524 (ArithmeticOverflow + DepositCountOverflow):
those checked_add paths are defensive — the token's i128 supply bounds
escrow.amount / contribution.amount / deposit-count, so a caller can't push
them past overflow through the public API. No honest test can trigger them;
flagged here rather than writing a fake one.
@vercel

vercel Bot commented Oct 14, 2026

Copy link
Copy Markdown

@yggdrasilworld is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

@yggdrasilworld
yggdrasilworld deleted the test/error-path-coverage branch October 19, 2026 02:34
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.

escrow: the Error::InvalidTreasury path has no test

1 participant