circuit breaker pool extension#326
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new CircuitBreaker pool extension intended to pause swaps after large within-block tick movement (“black swan” protection), along with supporting packed state + helper library and a dedicated test suite (including a gas snapshot).
Changes:
- Introduces
CircuitBreakerextension withbeforeInitializePool,beforeSwap, andafterSwaphooks to enforce tick-movement limits and halting. - Adds
CircuitBreakerPoolStatepacked type +CircuitBreakerLibhelper functions for reading state and determining fuse status. - Adds
CircuitBreaker.t.soltests and a snapshot entry for swap gas measurement.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/extensions/CircuitBreaker.sol |
Implements circuit breaker extension logic and storage for per-pool state. |
src/types/circuitBreakerPoolState.sol |
Adds packed state encoding/decoding helpers for last swap timestamp + block start tick. |
src/libraries/CircuitBreakerLib.sol |
Adds convenience getters for pool state, reset time, elapsed time, and fuse-tripped checks. |
src/interfaces/extensions/ICircuitBreaker.sol |
Defines extension interface (params + errors). |
test/extensions/CircuitBreaker.t.sol |
Adds tests covering registration, init, revert paths, fuse behavior, and gas snapshot. |
snapshots/CircuitBreakerTest.json |
Stores gas snapshot for a representative circuit-breaker swap scenario. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/EkuboProtocol/evm-contracts/sessions/413020c2-f491-4eac-9f7f-0729ed0e28d9 Co-authored-by: moodysalem <7897876+moodysalem@users.noreply.github.com>
Applied the requested thread fixes in commit |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot fix the tests |
Agent-Logs-Url: https://github.com/EkuboProtocol/evm-contracts/sessions/20730d73-f8f7-486e-baf5-20aa2dbc781e Co-authored-by: moodysalem <7897876+moodysalem@users.noreply.github.com>
Fixed. Commit |
Add circuit breaker Ekubo extension with black-swan swap protection