Skip to content

test(maintenance-pool): cover Error::InvalidSplit on withdraw - #923

Merged
chonilius merged 1 commit into
MergeFi:mainfrom
defimomof2:fix/maintenance-pool-invalid-split-test-836
Nov 21, 2026
Merged

chonilius merged 1 commit into
MergeFi:mainfrom
defimomof2:fix/maintenance-pool-invalid-split-test-836

Conversation

@defimomof2

@defimomof2 defimomof2 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Error::InvalidSplit (code 17) is returned by maintenance-pool withdraw when compute_split rejects the recipient list (path added in #483), but no test in contracts/maintenance-pool/src/test.rs asserted it.

Adds test_withdraw_rejects_invalid_split, which asserts try_withdraw returns Err(Ok(Error::InvalidSplit)) for:

  • recipient bps summing below 10000
  • recipient bps summing above 10000
  • an empty recipient list
  • a duplicate recipient address

and that rejected withdrawals leave pool balance, total_withdrawn, and recipient token balances untouched.

Testing

cargo test -p mergefi-maintenance-pool test_withdraw_rejects_invalid_split passes (verified on the previous main tip; this PR only touches contracts/maintenance-pool/src/test.rs).

Note: current main does not compile independently of this change: PERSISTENT_TTL_EXTEND_TO is defined twice in contracts/common/src/lib.rs (lines 127 and 162, E0428) after a recent merge, so CI may fail until that is fixed.

Closes #836

Not resolved in this PR

The following are still open and are not addressed here:
Closes #837
Closes #842

Asserts withdraw returns InvalidSplit when recipient bps sum below or
above 10000, the recipient list is empty, or an address is duplicated,
and that rejected withdrawals leave pool balance and recipients untouched.
@vercel

vercel Bot commented Nov 21, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Nov 21, 2026

Copy link
Copy Markdown

@defimomof2 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@chonilius
chonilius merged commit 0d2b2ce into MergeFi:main Nov 21, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants