Skip to content

test(vaults): add zero-balance, rounding, and lockup tests - #868

Open
mikwansa wants to merge 3 commits into
BCPathway:mainfrom
mikwansa:feat/stellar-drips-wave-737-738-739
Open

test(vaults): add zero-balance, rounding, and lockup tests#868
mikwansa wants to merge 3 commits into
BCPathway:mainfrom
mikwansa:feat/stellar-drips-wave-737-738-739

Conversation

@mikwansa

Copy link
Copy Markdown

Summary

Adds the three Testing-bucket deliverables for the Yield-Bearing Fee Vaults epic to the wrapper contract (the epic's real vault implementation, matching how #736 was resolved in #863):

  • [Testing] Test: 0-balance deposit reverts #737 – zero-balance deposit and withdrawal revert tests, including on an empty vault before any shares exist, asserting failed calls leave state untouched.
  • [Testing] Test: Reward distribution rounding #738 – reward distribution rounding tests: prime-number deposits, an uneven reward, and full exits, asserting each payout never exceeds the pro-rata entitlement and the vault pays out no more than it received.
  • [Testing] Test: Lockup enforcement #739 – lockup enforcement: the full deposit → locked-withdraw-reverts → advance-time → withdraw-succeeds cycle. Also fixes a genuine bypass: unwrap() did not run the require_unlocked guard (only withdraw() did), so a time-locked depositor could exit early via unwrap — the guard now applies to both paths, and a test covers it.

Changes

  • contracts/wrapper/src/test.rs: 4 new tests across three themed sections (mirrors the existing #736/#730 test-section convention).
  • contracts/wrapper/src/lib.rs: unwrap() now enforces the deposit time lockup via require_unlocked, matching withdraw().

Closes #737
Closes #738
Closes #739

mikwansa and others added 3 commits August 31, 2026 10:11
…ay#737)

Covers the 0-amount deposit and 0-amount withdrawal revert paths,
including on an empty vault before any shares exist, and asserts the
failed calls leave vault state untouched.

Closes BCPathway#737

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Deposits prime-number amounts, distributes a reward that does not
divide evenly, and asserts each payout never exceeds the user's
pro-rata entitlement and the vault pays out no more than it received.

Closes BCPathway#738

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
…athway#739)

unwrap() bypassed the deposit time lockup because only withdraw()
ran the require_unlocked guard, letting a time-locked depositor exit
early. Adds the guard to unwrap() and tests the full deposit ->
locked withdraw -> advance time -> withdraw cycle, plus the unwrap
bypass path.

Closes BCPathway#739

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@mikwansa 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

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.

[Testing] Test: Lockup enforcement [Testing] Test: Reward distribution rounding [Testing] Test: 0-balance deposit reverts

1 participant