1
1
package app
2
2
3
3
import (
4
+ "errors"
5
+
4
6
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
5
7
"github.com/cosmos/ibc-go/v7/modules/core/keeper"
6
8
7
- errorsmod "cosmossdk.io/errors"
9
+ corestoretypes "cosmossdk.io/core/store"
10
+ circuitante "cosmossdk.io/x/circuit/ante"
11
+ circuitkeeper "cosmossdk.io/x/circuit/keeper"
8
12
9
- storetypes "github.com/cosmos/cosmos-sdk/store/types"
10
13
sdk "github.com/cosmos/cosmos-sdk/types"
11
- sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
12
14
"github.com/cosmos/cosmos-sdk/x/auth/ante"
13
15
14
16
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
@@ -20,32 +22,37 @@ import (
20
22
type HandlerOptions struct {
21
23
ante.HandlerOptions
22
24
23
- IBCKeeper * keeper.Keeper
24
- WasmConfig * wasmTypes.WasmConfig
25
- TXCounterStoreKey storetypes.StoreKey
25
+ IBCKeeper * keeper.Keeper
26
+ WasmConfig * wasmTypes.WasmConfig
27
+ TXCounterStoreService corestoretypes.KVStoreService
28
+ CircuitKeeper * circuitkeeper.Keeper
26
29
}
27
30
28
31
func NewAnteHandler (options HandlerOptions ) (sdk.AnteHandler , error ) {
29
32
if options .AccountKeeper == nil {
30
- return nil , errorsmod . Wrap ( sdkerrors . ErrLogic , "account keeper is required for AnteHandler " )
33
+ return nil , errors . New ( "account keeper is required for ante builder " )
31
34
}
32
35
if options .BankKeeper == nil {
33
- return nil , errorsmod . Wrap ( sdkerrors . ErrLogic , "bank keeper is required for AnteHandler " )
36
+ return nil , errors . New ( "bank keeper is required for ante builder " )
34
37
}
35
38
if options .SignModeHandler == nil {
36
- return nil , errorsmod . Wrap ( sdkerrors . ErrLogic , "sign mode handler is required for ante builder" )
39
+ return nil , errors . New ( "sign mode handler is required for ante builder" )
37
40
}
38
41
if options .WasmConfig == nil {
39
- return nil , errorsmod .Wrap (sdkerrors .ErrLogic , "wasm config is required for ante builder" )
42
+ return nil , errors .New ("wasm config is required for ante builder" )
43
+ }
44
+ if options .TXCounterStoreService == nil {
45
+ return nil , errors .New ("wasm store service is required for ante builder" )
40
46
}
41
- if options .TXCounterStoreKey == nil {
42
- return nil , errorsmod . Wrap ( sdkerrors . ErrLogic , "tx counter key is required for ante builder" )
47
+ if options .CircuitKeeper == nil {
48
+ return nil , errors . New ( "circuit keeper is required for ante builder" )
43
49
}
44
50
45
51
anteDecorators := []sdk.AnteDecorator {
46
52
ante .NewSetUpContextDecorator (), // outermost AnteDecorator. SetUpContext must be called first
47
53
wasmkeeper .NewLimitSimulationGasDecorator (options .WasmConfig .SimulationGasLimit ), // after setup context to enforce limits early
48
- wasmkeeper .NewCountTXDecorator (options .TXCounterStoreKey ),
54
+ wasmkeeper .NewCountTXDecorator (options .TXCounterStoreService ),
55
+ circuitante .NewCircuitBreakerDecorator (options .CircuitKeeper ),
49
56
ante .NewExtensionOptionsDecorator (options .ExtensionOptionChecker ),
50
57
ante .NewValidateBasicDecorator (),
51
58
ante .NewTxTimeoutHeightDecorator (),
0 commit comments