Skip to content

feat: add circuit-breaker pause pattern to stealth-sender and wraith-names#77

Open
postqcoin wants to merge 2 commits into
wraith-protocol:mainfrom
postqcoin:feat/circuit-breaker-pause-pattern
Open

feat: add circuit-breaker pause pattern to stealth-sender and wraith-names#77
postqcoin wants to merge 2 commits into
wraith-protocol:mainfrom
postqcoin:feat/circuit-breaker-pause-pattern

Conversation

@postqcoin

Copy link
Copy Markdown

Summary

Implements admin-controlled pause mechanism (circuit-breaker) for the two contracts that handle state mutations.

Contract Changes

stealth-sender

  • Add Paused storage key and ContractPaused error
  • Add pause(), unpause(), is_paused() admin functions
  • Add require_not_paused() check to send() and batch_send()
  • Upgrade/admin functions remain operational during pause

wraith-names

  • Add Admin storage key and init() with admin parameter
  • Add Paused storage key and ContractPaused error
  • Add pause(), unpause(), is_paused() admin functions
  • Add require_not_paused() check to register(), update(), release()
  • resolve() and name_of() remain available (read-only) when paused

Not Pausable (by design)

  • stealth-announcer: pure event emitter, no state to protect
  • stealth-registry: stateless, redeploy if needed

Documentation

  • PAUSE.md: per-contract pause behavior and incident response playbook
  • Tests: 7 new adversarial pause tests for wraith-names

Closes #75

Implements upgrade admin mechanism for stealth-sender contract with
comprehensive adversarial test suite proving security properties.

Contract changes (stealth-sender):
- Add Admin and Renounced storage keys
- Add admin parameter to init() for upgrade authority
- Add upgrade() function using deployer().update_current_contract_wasm()
- Add set_admin() for admin transfer (requires current admin auth)
- Add renounce_upgrade_authority() for permanent irreversable renouncement
- Add get_admin() and is_renounced() view functions

Adversarial test suite:
- test_non_admin_cannot_upgrade — verifies auth enforcement
- test_admin_can_upgrade — happy path upgrade
- test_admin_can_renounce — renounce flow
- test_cannot_renounce_twice — double-renounce prevention
- test_cannot_upgrade_after_renounce — post-renounce blocked
- test_cannot_set_admin_after_renounce — admin change blocked post-renounce
- test_admin_can_change_admin — admin transfer
- test_non_admin_cannot_change_admin — admin transfer auth
- test_admin_change_preserves_announcer — state preservation

GOVERNANCE.md:
- Documents upgrade classification per contract
- Describes admin role and upgrade mechanism
- Documents renounce mechanism and security properties
- Lists test coverage and mainnet readiness checklist

Closes wraith-protocol#57
…names

Implements admin-controlled pause mechanism (circuit-breaker) for the
two contracts that handle state mutations:

stealth-sender:
- Add Paused storage key and ContractPaused error
- Add pause(), unpause(), is_paused() admin functions
- Add require_not_paused() check to send() and batch_send()
- Upgrade/admin functions remain operational during pause

wraith-names:
- Add Admin storage key and init() with admin parameter
- Add Paused storage key and ContractPaused error
- Add pause(), unpause(), is_paused() admin functions
- Add require_not_paused() check to register(), update(), release()
- resolve() and name_of() remain available (read-only) when paused

Not pausable (by design):
- stealth-announcer: pure event emitter, no state
- stealth-registry: stateless, redeploy if needed

Documentation:
- PAUSE.md: per-contract pause behavior and incident response playbook
- Tests: 7 new adversarial pause tests for wraith-names

Closes wraith-protocol#75
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.

Soroban contract pause/circuit-breaker pattern audit + implementation

2 participants