fix: unpause() clears AutoPaused to prevent stuck contract (#452) - #710
Open
Nife-tanny wants to merge 2 commits into
Open
fix: unpause() clears AutoPaused to prevent stuck contract (#452)#710Nife-tanny wants to merge 2 commits into
Nife-tanny wants to merge 2 commits into
Conversation
…-tuple campaign_metadata_updated event shape
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.
Description
Fixes the contract getting stuck in an auto-paused state when the campaign that triggered the automatic pause is subsequently cancelled.
Root Cause
When a burst contribution triggers an automatic pause,
resume_campaigncallsrequire_active_campaignbefore clearing theAutoPausedflag. If the triggering campaign is cancelled (making it inactive),resume_campaignfails at therequire_active_campaigncheck, leavingAutoPausedpermanentlytruewith no way to clear it — the contract is stuck.Fix
Updated
unpause()insrc/admin.rsto clear both pause flags:Previously
unpause()only clearedPaused, leavingAutoPauseduntouched with no public recovery path.Changes
src/admin.rs: Addedenv.storage().instance().set(&AdminKey::AutoPaused, &false);tounpause()CHANGELOG.md: Added entry for the fix under[Unreleased]→### Fixedassert_adminstill gates the functionTests
The existing regression test
test_unpause_clears_auto_pause_when_resume_campaign_blockedinsrc/tests/test_campaigns.rsvalidates:AutoPaused = true→ operations blockedunpause()called → both flags clearedresume_campaignstill fails for cancelled campaigns (unchanged behavior)unpause()Closes #452