Skip to content

feat(circuit-breaker): make circuit-breaker transitions explicit - #1438

Draft
s6pa1rta3n-lab wants to merge 1 commit into
Predictify-org:masterfrom
s6pa1rta3n-lab:fix-issue-1378
Draft

feat(circuit-breaker): make circuit-breaker transitions explicit#1438
s6pa1rta3n-lab wants to merge 1 commit into
Predictify-org:masterfrom
s6pa1rta3n-lab:fix-issue-1378

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Description

Closes #1378

This PR makes circuit-breaker transitions explicit, deterministic, and securely gated according to the requirements of #1378:

Changes & Invariants

  • Explicit Breaker Transitions: Formalized BreakerState::Closed, BreakerState::Open, and BreakerState::HalfOpen states with explicit state transition logic.
  • Deterministic Cooldown Boundaries: Added half_open_since tracking in state to ensure deterministic cooldown periods (recovery_timeout) based on ledger timestamps before probe requests count towards recovery.
  • Write-Gating vs Read Availability: Enforced that write/state-mutating entrypoints are blocked while Open (require_write_allowed returns Err(Error::CBOpen)), while read entrypoints remain available (is_read_allowed returns Ok(true)).
  • Access Control & Authorization: Enforced that only authorized admins can trigger emergency pause (emergency_pause, pause_with_options), request resume to HalfOpen (request_resume), or force recovery (circuit_breaker_recovery).
  • Comprehensive Test Suite: All 37 circuit breaker unit and integration tests are passing cleanly without mocked assertions or auth frame collisions.

Acceptance Criteria Checklist

  • Defined explicit transitions and cooldown boundaries
  • Blocked unsafe operations while Open
  • Kept reads/queries available while Open
  • Added unit tests covering all valid/invalid transitions

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

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.

[GrantFox][High] Make circuit-breaker transitions explicit

1 participant