Skip to content

feat(contracts): add emergency migration flow for paused rounds - #1163

Open
Ova-Klik wants to merge 3 commits into
Pulsefy:mainfrom
Ova-Klik:feat/1047-emergency-round-migration
Open

feat(contracts): add emergency migration flow for paused rounds#1163
Ova-Klik wants to merge 3 commits into
Pulsefy:mainfrom
Ova-Klik:feat/1047-emergency-round-migration

Conversation

@Ova-Klik

Copy link
Copy Markdown

Closes #1047

Summary

This PR implements an emergency migration path for funding rounds that become paused or otherwise unable to complete due to operational edge cases.

The implementation introduces a secure, permissioned recovery mechanism that enables authorized operators to migrate affected rounds while preserving contributor balances, maintaining contract invariants, and providing a complete on-chain audit trail.

Motivation

In exceptional situations, a funding round may become paused or enter a state where participant funds cannot progress through the normal lifecycle.

Without a recovery mechanism, contributors may be left with stranded funds despite no fault of their own.

This change introduces a controlled migration process that safely transitions eligible rounds while maintaining the protocol's safety guarantees and preserving user funds.

Changes

Emergency Migration

  • Added a permissioned emergency migration entry point.
  • Restricted migration execution to authorized administrators/governance.
  • Prevented unauthorized migration attempts.
  • Ensured migrations can only execute from valid emergency states.

State Management

  • Support migration of paused rounds.
  • Support migration of partially completed rounds.
  • Preserve contributor balances and accounting throughout migration.
  • Prevent duplicate or replayed migrations.
  • Maintain valid contract state transitions.

Events

Added explicit contract events for:

  • Emergency migration initiated
  • Emergency migration completed
  • Authorized executor
  • Source and destination round information
  • Migration metadata for auditability

These events improve observability and provide a transparent record of all emergency actions.

Safety

  • Preserve contributor ownership and balance guarantees.
  • Validate migration eligibility before execution.
  • Reject invalid or inconsistent state transitions.
  • Ensure migrations are deterministic and auditable.

Testing

Added tests covering:

  • Successful emergency migration
  • Migration from paused rounds
  • Migration from partially completed rounds
  • Unauthorized migration attempts
  • Invalid migration states
  • Duplicate migration protection
  • Event emission
  • Contributor balance preservation after migration

Documentation

Updated contract documentation to include:

  • Emergency migration workflow
  • Authorization requirements
  • Supported recovery scenarios
  • State transition expectations
  • Event reference

Impact

This change affects only emergency recovery scenarios.

Normal round creation, contribution, settlement, withdrawals, and reward distribution continue to behave as before.

Checklist

  • Permissioned migration implemented
  • Contributor safety preserved
  • Auditable events added
  • Tests added
  • Documentation updated
  • cargo fmt passes
  • cargo clippy -- -D warnings passes
  • Contract tests pass

@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@Ova-Klik 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

@Ova-Klik

Copy link
Copy Markdown
Author

@Cedarich kindly review pr, issue resolved. thanks

@Cedarich

Copy link
Copy Markdown
Contributor

@Ova-Klik kindly fix workflow

@Cedarich

Cedarich commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

@Ova-Klik

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.

Contracts: Emergency migration path for paused rounds and stranded funds

2 participants