x/circuit module is a circuit breaker module meant to prohibit specific txs from being executed.
Read more in https://docs.cosmos.network/main/modules/circuit.
It works thanks to two components:
@reecepbcups rightfully pointed that the default circuit ante handler does not check for inner messages.
That is correct, this means any messages containing inner messages (x/authz, x/gov, or any custom modules having that) will pass the ante handler but fail at CheckTx.
However, it is important to note that such messages will never get executed and will properly fail at the message router check.
The reason the CircuitBreakerDecorator does not do those checks is because, currently, it would introduce dependencies (x/authz, x/gov) in the x/circuit module and the circuit cannot (currently) know if a transaction contains inner msgs. Additionally, standalone SDK modules aim to require strictly necessary dependencies.
This means it is expected that the circuit ante handler does not perform those checks. Chains can re-define their circuit ante handler that handles all messages containing inner messages if they really wish too (because a chain can exhaustively know what are their applicable messages).
This tradeoff in the default circuit ante handler should be made clearer in the circuit docs (https://docs.cosmos.network/main/modules/circuit).
x/circuitmodule is a circuit breaker module meant to prohibit specific txs from being executed.Read more in https://docs.cosmos.network/main/modules/circuit.
It works thanks to two components:
CircuitBreakerDecoratorante handler:https://github.com/cosmos/cosmos-sdk/blob/x/circuit/v0.1.0/x/circuit/ante/circuit.go#L27-L41
https://github.com/cosmos/cosmos-sdk/blob/v0.50.1/baseapp/msg_service_router.go#L104-L115
@reecepbcups rightfully pointed that the default circuit ante handler does not check for inner messages.
That is correct, this means any messages containing inner messages (x/authz, x/gov, or any custom modules having that) will pass the ante handler but fail at
CheckTx.However, it is important to note that such messages will never get executed and will properly fail at the message router check.
The reason the
CircuitBreakerDecoratordoes not do those checks is because, currently, it would introduce dependencies (x/authz, x/gov) in the x/circuit module and the circuit cannot (currently) know if a transaction contains inner msgs. Additionally, standalone SDK modules aim to require strictly necessary dependencies.This means it is expected that the circuit ante handler does not perform those checks. Chains can re-define their circuit ante handler that handles all messages containing inner messages if they really wish too (because a chain can exhaustively know what are their applicable messages).
This tradeoff in the default circuit ante handler should be made clearer in the circuit docs (https://docs.cosmos.network/main/modules/circuit).