From b1cf4793d09247247fdf4b769062f9c2edd0c905 Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 20 Apr 2021 09:21:37 +0000 Subject: [PATCH] consistency in antehandler (#9144) --- x/auth/ante/ante.go | 2 +- x/auth/ante/basic.go | 6 ++++++ x/auth/ante/basic_test.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/x/auth/ante/ante.go b/x/auth/ante/ante.go index 8df98f0e4..3b4aa6a56 100644 --- a/x/auth/ante/ante.go +++ b/x/auth/ante/ante.go @@ -43,7 +43,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { NewRejectExtensionOptionsDecorator(), NewMempoolFeeDecorator(), NewValidateBasicDecorator(), - TxTimeoutHeightDecorator{}, + NewTxTimeoutHeightDecorator(), NewValidateMemoDecorator(options.AccountKeeper), NewConsumeGasForTxSizeDecorator(options.AccountKeeper), NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper), diff --git a/x/auth/ante/basic.go b/x/auth/ante/basic.go index 7ed834eba..8ba07d858 100644 --- a/x/auth/ante/basic.go +++ b/x/auth/ante/basic.go @@ -179,6 +179,12 @@ type ( } ) +// TxTimeoutHeightDecorator defines an AnteHandler decorator that checks for a +// tx height timeout. +func NewTxTimeoutHeightDecorator() TxTimeoutHeightDecorator { + return TxTimeoutHeightDecorator{} +} + // AnteHandle implements an AnteHandler decorator for the TxHeightTimeoutDecorator // type where the current block height is checked against the tx's height timeout. // If a height timeout is provided (non-zero) and is less than the current block diff --git a/x/auth/ante/basic_test.go b/x/auth/ante/basic_test.go index 085673488..4a8cb830f 100644 --- a/x/auth/ante/basic_test.go +++ b/x/auth/ante/basic_test.go @@ -177,7 +177,7 @@ func (suite *AnteTestSuite) TestConsumeGasForTxSize() { func (suite *AnteTestSuite) TestTxHeightTimeoutDecorator() { suite.SetupTest(true) - antehandler := sdk.ChainAnteDecorators(ante.TxTimeoutHeightDecorator{}) + antehandler := sdk.ChainAnteDecorators(ante.NewTxTimeoutHeightDecorator()) // keys and addresses priv1, _, addr1 := testdata.KeyTestPubAddr()