-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: stana-ethernal <[email protected]> Co-authored-by: jstr1121 <[email protected]> Co-authored-by: jstr1121 <[email protected]> Co-authored-by: Aidan Salzmann <[email protected]> Co-authored-by: Son Trinh <[email protected]> Co-authored-by: Jacob Gadikian <[email protected]> Co-authored-by: sampocs <[email protected]> Co-authored-by: sampocs <[email protected]> Co-authored-by: strbrian <[email protected]>
- Loading branch information
1 parent
4db410e
commit b4abd61
Showing
440 changed files
with
2,909 additions
and
1,038 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package app | ||
|
||
import ( | ||
errorsmod "cosmossdk.io/errors" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
"github.com/cosmos/cosmos-sdk/x/auth/ante" | ||
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" | ||
democracyante "github.com/cosmos/interchain-security/v3/app/consumer-democracy/ante" | ||
consumerante "github.com/cosmos/interchain-security/v3/app/consumer/ante" | ||
ccvconsumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper" | ||
) | ||
|
||
// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC | ||
// channel keeper. | ||
type HandlerOptions struct { | ||
ante.HandlerOptions | ||
|
||
IBCKeeper *ibckeeper.Keeper | ||
ConsumerKeeper ccvconsumerkeeper.Keeper | ||
} | ||
|
||
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { | ||
if options.AccountKeeper == nil { | ||
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") | ||
} | ||
if options.BankKeeper == nil { | ||
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") | ||
} | ||
if options.SignModeHandler == nil { | ||
return nil, errorsmod.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(), | ||
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), | ||
// temporarily disabled so that chain can be tested locally without the provider chain running | ||
consumerante.NewDisabledModulesDecorator("/cosmos.evidence", "/cosmos.slashing"), | ||
democracyante.NewForbiddenProposalsDecorator(IsProposalWhitelisted, IsModuleWhiteList), | ||
// ante.NewMempoolFeeDecorator(), | ||
ante.NewValidateBasicDecorator(), | ||
ante.NewTxTimeoutHeightDecorator(), | ||
ante.NewValidateMemoDecorator(options.AccountKeeper), | ||
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), | ||
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), | ||
// SetPubKeyDecorator must be called before all signature verification decorators | ||
ante.NewSetPubKeyDecorator(options.AccountKeeper), | ||
ante.NewValidateSigCountDecorator(options.AccountKeeper), | ||
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer), | ||
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), | ||
ante.NewIncrementSequenceDecorator(options.AccountKeeper), | ||
} | ||
|
||
return sdk.ChainAnteDecorators(anteDecorators...), nil | ||
} |
Oops, something went wrong.