Skip to content

Commit c6710e1

Browse files
mergify[bot]avorylliAlex | Interchain Labs
authored
docs: Add Circuit Breaker CLI command examples (backport #24680) (#24731)
Co-authored-by: Avory <[email protected]> Co-authored-by: Alex | Interchain Labs <[email protected]>
1 parent 07eebe3 commit c6710e1

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

x/circuit/README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,90 @@ The circuit module emits the following events:
168168
* `DisableListPrefix` - `0x02`
169169

170170
## Client - list and describe CLI commands and gRPC and REST endpoints
171+
172+
## Examples: Using Circuit Breaker CLI Commands
173+
174+
This section provides practical examples for using the Circuit Breaker module through the command-line interface (CLI). These examples demonstrate how to authorize accounts, disable (trip) specific message types, and re-enable (reset) them when needed.
175+
176+
### Querying Circuit Breaker Permissions
177+
178+
Check an account's current circuit breaker permissions:
179+
180+
```bash
181+
# Query permissions for a specific account
182+
<appd> query circuit account-permissions <account_address>
183+
184+
# Example:
185+
simd query circuit account-permissions cosmos1...
186+
```
187+
188+
Check which message types are currently disabled:
189+
190+
```bash
191+
# Query all disabled message types
192+
<appd> query circuit disabled-list
193+
194+
# Example:
195+
simd query circuit disabled-list
196+
```
197+
198+
### Authorizing an Account as Circuit Breaker
199+
200+
Only a super-admin or the module authority (typically the governance module account) can grant circuit breaker permissions to other accounts:
201+
202+
```bash
203+
# Grant LEVEL_ALL_MSGS permission (can disable any message type)
204+
<appd> tx circuit authorize <grantee_address> --level=ALL_MSGS --from=<super_admin_key> --gas=auto --gas-adjustment=1.5
205+
206+
# Grant LEVEL_SOME_MSGS permission (can only disable specific message types)
207+
<appd> tx circuit authorize <grantee_address> --level=SOME_MSGS --limit-type-urls="/cosmos.bank.v1beta1.MsgSend,/cosmos.staking.v1beta1.MsgDelegate" --from=<super_admin_key> --gas=auto --gas-adjustment=1.5
208+
209+
# Grant LEVEL_SUPER_ADMIN permission (can disable messages and authorize other accounts)
210+
<appd> tx circuit authorize <grantee_address> --level=SUPER_ADMIN --from=<super_admin_key> --gas=auto --gas-adjustment=1.5
211+
```
212+
213+
### Disabling Message Processing (Trip)
214+
215+
Disable specific message types to prevent their execution (requires authorization):
216+
217+
```bash
218+
# Disable a single message type
219+
<appd> tx circuit trip --type-urls="/cosmos.bank.v1beta1.MsgSend" --from=<authorized_key> --gas=auto --gas-adjustment=1.5
220+
221+
# Disable multiple message types
222+
<appd> tx circuit trip --type-urls="/cosmos.bank.v1beta1.MsgSend,/cosmos.staking.v1beta1.MsgDelegate" --from=<authorized_key> --gas=auto --gas-adjustment=1.5
223+
224+
# Disable all message types (emergency measure)
225+
<appd> tx circuit trip --from=<authorized_key> --gas=auto --gas-adjustment=1.5
226+
```
227+
228+
### Re-enabling Message Processing (Reset)
229+
230+
Re-enable previously disabled message types (requires authorization):
231+
232+
```bash
233+
# Re-enable a single message type
234+
<appd> tx circuit reset --type-urls="/cosmos.bank.v1beta1.MsgSend" --from=<authorized_key> --gas=auto --gas-adjustment=1.5
235+
236+
# Re-enable multiple message types
237+
<appd> tx circuit reset --type-urls="/cosmos.bank.v1beta1.MsgSend,/cosmos.staking.v1beta1.MsgDelegate" --from=<authorized_key> --gas=auto --gas-adjustment=1.5
238+
239+
# Re-enable all disabled message types
240+
<appd> tx circuit reset --from=<authorized_key> --gas=auto --gas-adjustment=1.5
241+
```
242+
243+
### Usage in Emergency Scenarios
244+
245+
In case of a critical vulnerability in a specific message type:
246+
247+
1. Quickly disable the vulnerable message type:
248+
```bash
249+
<appd> tx circuit trip --type-urls="/cosmos.vulnerable.v1beta1.MsgVulnerable" --from=<authorized_key> --gas=auto --gas-adjustment=1.5
250+
```
251+
252+
2. After a fix is deployed, re-enable the message type:
253+
```bash
254+
<appd> tx circuit reset --type-urls="/cosmos.vulnerable.v1beta1.MsgVulnerable" --from=<authorized_key> --gas=auto --gas-adjustment=1.5
255+
```
256+
257+
This allows chains to surgically disable problematic functionality without halting the entire chain, providing time for developers to implement and deploy fixes.

0 commit comments

Comments
 (0)