Skip to content

feat(circuit-breaker): guardian-quorum pause with delayed admin unpause - #391

Merged
Mkalbani merged 1 commit into
MindFlowInteractive:mainfrom
Favouratambi:feat/369-circuit-breaker-guardian-quorum
Nov 20, 2026
Merged

Mkalbani merged 1 commit into
MindFlowInteractive:mainfrom
Favouratambi:feat/369-circuit-breaker-guardian-quorum

Conversation

@Favouratambi

Copy link
Copy Markdown
Contributor

Summary

Implements issue #369: a reusable guardian-quorum circuit breaker module at contracts/circuit_breaker.

  • Guardian set & quorum: configured at initialization, admin-managed; quorum must be a strict majority (quorum <= N and 2 * quorum > N).
  • Propose/approve pause: a guardian proposes (their approval counts), other guardians approve with approve_pause; the breaker trips as soon as quorum is reached. Proposals expire after a configurable TTL and can be canceled by the proposer.
  • Pause state checked by integrators: is_paused, get_pause_state, get_status and assert_callable(function). Other contracts can depend on the crate and call the exported enforce_not_paused(&env, &breaker, &function) guard at state-changing entry points.
  • Restricted surface while paused: only an explicit allowlist remains callable (views + unpause flow by default); the unpause entry points cannot be removed from it.
  • Delayed, admin-approved unpause: a guardian/admin requests it, then only the admin can execute it, and only after unpause_delay seconds from the pause timestamp (default 2 hours). The delay is re-checked at execution so it cannot be bypassed.
  • Auditability: pause history records plus events for every transition; README documents the design and integration pattern.

Testing

  • 20 tests (18 unit + 2 integration) covering quorum enforcement, single/duplicate/stale approvals, proposal expiry and cancellation, allowlist behavior, admin-only configuration, timelock enforcement, repeated pauses, and a mock vault that consumes the module and proves state changes are rejected while paused.
  • Added .github/workflows/circuit-breaker.yml running cargo fmt --check, cargo test --locked, cargo clippy --all-targets -- -D warnings and a wasm32v1-none release build on PRs touching this module.
  • Committed a lockfile pinning ed25519-dalek to 2.2.0, the same SDK 21 compatibility workaround already used by contracts/streak_counter.

Closes #369

@drips-wave

drips-wave Bot commented Nov 20, 2026

Copy link
Copy Markdown

@Favouratambi 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

@Favouratambi
Favouratambi force-pushed the feat/369-circuit-breaker-guardian-quorum branch from 0b208e2 to f663517 Compare November 20, 2026 14:08
@Mkalbani
Mkalbani merged commit 9828c34 into MindFlowInteractive:main Nov 20, 2026
@grantfox-oss grantfox-oss Bot mentioned this pull request Nov 20, 2026
6 tasks
Mkalbani pushed a commit that referenced this pull request Nov 20, 2026
Mkalbani added a commit that referenced this pull request Nov 20, 2026
fix(circuit-breaker): restore green CI after #391
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.

Circuit Breaker with Guardian Quorum

2 participants