Skip to content

[Contract] Global circuit-breaker / emergency pause across all mutating entrypoints #30

Open

Description

@Gbangbolaoluwagbemiga

Problem

Pausing today only covers job creation (pause_job_creation / is_job_creation_paused). In an
incident (discovered exploit, compromised token) there is no way to halt approvals, refunds, or
arbiter actions. An auditor will flag the lack of a global circuit-breaker.

What needs to be done

  • Add a global Paused flag in storage + pause() / unpause() (owner-only)
  • Add a require_not_paused(env) guard and call it at the top of every state-changing entrypoint
    (create_escrow, start_work, submit_milestone, approve_milestone, reject_milestone,
    dispute_*, refund paths, arbiter actions, ratings)
  • Keep view functions callable while paused
  • Emit Paused / Unpaused events (see [Contract] Emit structured events for all state transitions #5)

Acceptance criteria

  • When paused, all mutating calls return a typed Paused error
  • Views still work when paused
  • Only the owner can pause/unpause; tests cover unauthorized attempts

Relevant files

contracts/secureflow/src/admin.rs, lib.rs, every module with mutating entrypoints

Activity

  1. changed the title [-]Global circuit-breaker / pausable across all mutating entrypoints[/-] [+][Contract] Global circuit-breaker / emergency pause across all mutating entrypoints[/+] on Jun 17, 2026
  2. Ranjeet2063 commented on Oct 7, 2026

    @Ranjeet2063

    Hi team,

    Happy to tackle this. Here is how I plan to implement it:

    Plan:

    1. Audit storage layout and state invariants ensuring strict auth guards.
    2. Implement deterministic state transitions with safe checked arithmetic.
    3. Add hermetic unit and regression tests covering authorized, unauthorized, and boundary edge cases.
    4. Profile instruction and CPU/gas limits under Soroban host environment.

    Could you please assign this issue to me? Looking forward to delivering a clean PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    securitySecurity-sensitive work

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions