-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
Description
Description
Add security functionality allowing the Admin to pause contract operations in case of a discovered vulnerability or network issue.
Requirements and Context
- Background: Smart contracts are immutable, but operational control is needed for emergencies.
- Problem: If a bug is found, we cannot stop users from depositing funds.
- Success Criteria:
- Implement
set_paused(env, bool)(Admin only). - Add a check
ensure_not_paused(env)to all state-changing functions (create,release).
- Implement
- Impact: Critical risk mitigation feature.
Suggested Execution
- Add
Stateenum to storage (Active, Paused). - Implement
set_pausefunction requiring Admin auth. - Add a helper
fn check_active(env)that panics if state is Paused. - Call
check_activeat the start ofcreate_escrowandconfirm_delivery.
Test and Commit
- Testing: Pause the contract and verify
create_escrowfails. Unpause and verify it succeeds. - Commit Message:
feat(contract): implement emergency circuit breaker
Guidelines
- Read-only functions (getters) should likely remain accessible even when paused.
- PR Requirement: Closes #issue
Reactions are currently unavailable