Repository navigation
fix(maintenance-pool): prevent double-reclaim drain in reclaim_deposit - #725
Merged
chonilius merged 2 commits intoOct 18, 2026
Merged
Conversation
MergeFi#479) Zero the deposit record before transferring so a repeated call on the same index is rejected with AlreadyReclaimed instead of draining other sponsors' funds. Add AlreadyReclaimed = 17 to the error enum. Also add regression tests: - test_reclaim_deposit_second_call_rejected_with_already_reclaimed (MergeFi#479) - test_keep_alive_succeeds_on_existing_pool (MergeFi#476) - test_keep_alive_fails_on_nonexistent_pool (MergeFi#476) - test_keep_alive_succeeds_on_existing_milestone (MergeFi#475) - test_keep_alive_fails_on_nonexistent_milestone (MergeFi#475) Closes MergeFi#479 Closes MergeFi#476 Closes MergeFi#475 Closes MergeFi#480
|
@christianahtemitope2005 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! 🚀 |
|
@christianahtemitope2005 is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Problem
reclaim_depositnever marked a deposit as consumed after transferring funds. The same(pool_id, deposit_index)pair could be reclaimed repeatedly, draining other sponsors' funds until the pool balance fell below the deposit amount.Fix
Zero
deposit.amountand persist the record before the transfer (checks-effects-interactions pattern). A second call on the same index findsamount == 0and returns the newAlreadyReclaimed = 17error.Tests added
test_reclaim_deposit_second_call_rejected_with_already_reclaimed— verifies the drain path is closed ([Regression on closed #413] maintenance-pool::reclaim_deposit still never marks a deposit reclaimed — one sponsor can drain the pool #479)test_keep_alive_succeeds_on_existing_pool/test_keep_alive_fails_on_nonexistent_pool([Regression on closed #353] maintenance-pool::keep_alive still has no test #476)test_keep_alive_succeeds_on_existing_milestone/test_keep_alive_fails_on_nonexistent_milestone([Regression on closed #352] milestones::keep_alive still has no test #475)Closes #479
Closes #476
Closes #475
Closes #480