Repository navigation
Description
Description
This issue aims to address the implementation of Emergency Circuit Breaker with Scoped Function Guards & Time-Bound Auto-Expiry.
The core objective is to: Add a shared pausability primitive across the escrow, reputation, and loyalty contracts that can halt specific classes of operation during an incident, always leaves user-fund-recovery paths open, and auto-expires so a pause can never become a permanent freeze.
By completing this feature, we will ensure that the GuildWorkman protocol maintains its high standards for security, usability, and decentralized logic. This issue requires careful attention to the Smart Contract architecture and adherence to the existing project conventions.
When picking up this issue, please ensure you document any new dependencies or architectural decisions made during development.
Component
Smart Contracts (Soroban)
Difficulty
🔴 Hard
Current state
None of the three contracts has any halt mechanism. If a bug or an exploit is discovered in escrow, the only options available today are "watch it drain" or "upgrade under fire" — and the upgrade path itself is still being built out in #16 / #27.
The design constraint that makes this more than a boolean flag: a pause must never trap user funds. Pausing create_appointment (stop new money entering) is safe; pausing cancel_appointment (stop refunds leaving) creates a hostage situation. Scoped guards plus a ledger-time expiry are what separate a circuit breaker from a rug pull.
Tasks
- Review the existing Soroban workspace under
soroban-contracts/contracts/ - Implement the contract logic for: Emergency Circuit Breaker with Scoped Function Guards & Time-Bound Auto-Expiry
- Define pause scopes rather than one global flag, so entry paths can be halted independently of exit/refund paths
- Enforce that fund-recovery paths (
cancel_appointment, dispute resolution, tokenburn/transferof already-held balances) remain callable while paused, and document the reasoning - Implement ledger-time-bound auto-expiry with a maximum pause duration, so an unattended pause self-clears
- Gate pause/unpause behind the admin/governance authority, keeping it consistent with the guard introduced in Upgradeable Contract Architecture with Storage Migration & Governance Guard #16 and the signer rotation in Governance signer rotation for the upgrade guard #27
- Emit a clear signal on pause and unpause so off-chain monitoring can react (coordinate with the event work in the structured-events issue)
- Add a dedicated
Errorvariant for paused operations rather than reusingInvalidStatus - Write comprehensive unit and integration tests, including adversarial edge cases — non-admin pause attempts, refund-while-paused, and calls after expiry
- Add caching for cargo dependencies in CI
- Run
cargo fmt --checkandcargo clippy -- -D warnings - Run
cargo testandsoroban contract buildto verify the optimized WASM build
Acceptance Criteria
- Feature accurately implements the objective: Add a shared pausability primitive across the escrow, reputation, and loyalty contracts that can halt specific classes of operation during an incident, always leaves user-fund-recovery paths open, and auto-expires so a pause can never become a permanent freeze.
- While paused, no new funds can enter escrow, and existing funds can still be recovered by their rightful owner — proven by test
- A pause expires automatically at its deadline without requiring an admin transaction
- Only the admin/governance authority can pause or unpause; a non-admin attempt fails with a distinct error
- Any PR that introduces compiler or clippy warnings is automatically blocked
- Contract logic is covered by tests exercising success, failure, and attack paths
- Storage layout and authorization are documented and reviewed for safety
- Code is properly reviewed and approved by codeowners
Estimated Time
2-3 days
Activity
bbjiggy commentedon Aug 19, 2026
Hi, I would like to take up this issue. Below is the proposed design, architectural plan, and testing strategy for implementing the Emergency Circuit Breaker with Scoped Function Guards & Time-Bound Auto-Expiry across the Soroban workspace.
Architectural Design
To ensure uniform logic across
escrow,reputation, andloyalty, I will introduce a sharedpausablemodule inside the workspace's shared utilities/crates.Storage Data Structure:
Instead of relying solely on an administrative transaction to clear a pause state, every guard check evaluates the current ledger time:
create_appointment,mint_reputation, and new reward minting paths will invokerequire_not_paused(env, Scope).cancel_appointment, dispute resolution distributions, and emergency token withdrawals—will explicitly omit the pause guard. This guarantees funds are never trapped, even during an active pause.pause()will enforce a strictMAX_PAUSE_DURATIONconstant (e.g., 7 days) to prevent setting indefinite freeze states.pauseandunpausemethods will requireadmin.require_auth(), remaining compatible with the signer rotation and guard patterns established in#16and#27.PauseEvent { scopes: u32, expires_at: u64, caller: Address }UnpauseEvent { scopes: u32, caller: Address }Work Plan & Tasks
Pausablestate management and scope bitmask logic in the common smart contract crate.escrow,reputation, andloyaltyentrypoints.ContractError::OperationPausedacross contracts to distinguish pause halts fromInvalidStatus.actions/cacheorSwatinem/rust-cachefor Cargo target directories and dependencies.Testing Strategy
CreateAppointmentblocks new deposits whilecancel_appointmentexecutes without failure.env.ledger().set_timestamp()pastexpires_atto confirm operations resume automatically without anunpausetransaction.pause/unpausefail with authorization errors.cargo fmt --check,cargo clippy -- -D warnings,cargo test, andsoroban contract build.Sparexonzy95 commentedon Aug 19, 2026
I’m interested in taking this issue. I have experience working with Stellar/Soroban smart contracts and understand the security requirements around scoped pause guards, admin authorization, fund-recovery paths, and ledger-based auto-expiry. I’m confident I can implement this safely across the existing contracts, cover the critical success, failure, and adversarial cases with tests, and submit a solid PR within 2-3 days.
grantfox-oss commentedon Aug 19, 2026
🦊 GrantFox — @bbjiggy has been assigned to this issue as part of the Third Campaign campaign!
Next steps:
Closes #42)Good luck! Track your progress on GrantFox.
docs(contracts): cross-link the changelog entry to issue workman-labs#42
feat(contracts): emergency circuit breaker with scoped function guard…
grantfox-oss commentedon Aug 20, 2026
🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!
@bbjiggy's PR #46 was approved and merged by @meshackyaro.
🏆 @bbjiggy: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (780 total points). Track your full progress on GrantFox.
👏 Great work, @bbjiggy! Keep contributing to workman-labs.