-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add ibc-antehandler to the default handlers * fix: testnet cli command update genesis supply * chore: fix lint Co-authored-by: billy rennekamp <[email protected]>
- Loading branch information
1 parent
f6f354d
commit 23f6ee2
Showing
3 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package gaia | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
"github.com/cosmos/cosmos-sdk/x/auth/ante" | ||
"github.com/cosmos/cosmos-sdk/x/auth/signing" | ||
"github.com/cosmos/cosmos-sdk/x/auth/types" | ||
channelkeeper "github.com/cosmos/cosmos-sdk/x/ibc/core/04-channel/keeper" | ||
ibcante "github.com/cosmos/cosmos-sdk/x/ibc/core/ante" | ||
) | ||
|
||
type HandlerOptions struct { | ||
AccountKeeper ante.AccountKeeper | ||
BankKeeper types.BankKeeper | ||
SignModeHandler signing.SignModeHandler | ||
SigGasConsumer ante.SignatureVerificationGasConsumer | ||
IBCChannelkeeper channelkeeper.Keeper | ||
} | ||
|
||
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { | ||
if options.AccountKeeper == nil { | ||
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") | ||
} | ||
if options.BankKeeper == nil { | ||
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") | ||
} | ||
if options.SignModeHandler == nil { | ||
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") | ||
} | ||
|
||
var sigGasConsumer = options.SigGasConsumer | ||
if sigGasConsumer == nil { | ||
sigGasConsumer = ante.DefaultSigVerificationGasConsumer | ||
} | ||
|
||
anteDecorators := []sdk.AnteDecorator{ | ||
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first | ||
ante.NewRejectExtensionOptionsDecorator(), | ||
ante.NewMempoolFeeDecorator(), | ||
ante.NewValidateBasicDecorator(), | ||
ante.TxTimeoutHeightDecorator{}, | ||
ante.NewValidateMemoDecorator(options.AccountKeeper), | ||
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), | ||
ante.NewRejectFeeGranterDecorator(), | ||
// SetPubKeyDecorator must be called before all signature verification decorators | ||
ante.NewSetPubKeyDecorator(options.AccountKeeper), | ||
ante.NewValidateSigCountDecorator(options.AccountKeeper), | ||
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper), | ||
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer), | ||
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), | ||
ante.NewIncrementSequenceDecorator(options.AccountKeeper), | ||
ibcante.NewAnteDecorator(options.IBCChannelkeeper), | ||
} | ||
|
||
return sdk.ChainAnteDecorators(anteDecorators...), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters