What is a Circuit Breaker?
A circuit breaker is an automated safety mechanism that triggers protective actions when predefined thresholds are exceeded. Unlike manual emergency pauses, circuit breakers activate automatically based on on-chain conditions, providing immediate response to detected anomalies.
How Circuit Breakers Work
1. Monitoring: Contract tracks relevant metrics in real-time 2. Threshold Definition: Parameters set for acceptable ranges 3. Trigger Detection: Code detects when limits exceeded 4. Automatic Response: Pre-programmed actions execute 5. Reset Conditions: Criteria for normal operations to resumeCommon Circuit Breaker Triggers
Price Deviation: Asset prices move too far from oracle prices Volume Spikes: Unusual transaction volumes detected TVL Changes: Large deposits or withdrawals Utilization Rates: Borrowing or liquidity thresholds Time-Based: Rate limits on operations per block/periodCircuit Breaker Actions
When triggered, circuit breakers may:
- Pause specific functions
- Limit transaction sizes
- Disable new positions
- Enable protective liquidations
- Switch to backup oracles
Circuit Breakers in Practice
Lending Protocols:- Pause borrows when utilization hits 100%
- Limit collateral factor changes
- Enable emergency liquidations
- Limit price impact per trade
- Pause pools with abnormal pricing
- Rate limit large swaps
- Delay large transfers
- Require additional verification
- Limit daily transfer volumes
Design Considerations
False Positives: Overly sensitive triggers cause unnecessary pauses Manipulation Risk: Attackers might trigger breakers intentionally Recovery: Clear path to resume normal operations Transparency: Users should understand trigger conditionsCircuit Breaker vs Emergency Pause
| Aspect | Circuit Breaker | Emergency Pause |
|---|---|---|
| . . . . | . . . . . . . . - | . . . . . . . . - |
| Trigger | Automatic | Manual |
| Speed | Immediate | Depends on responder |
| Flexibility | Predefined only | Any situation |
| Trust | Trustless | Requires trusted party |
Limitations
- Can't detect all attack types
- Novel attacks may bypass thresholds
- May lock legitimate users during volatility
- Complexity adds potential bugs
Best Practices
- Test thresholds extensively
- Monitor trigger frequency
- Communicate breaker conditions
- Provide manual override capability
- Regular threshold review and adjustment