From f3962eb29bf38531e7cce2bca118af8e3450c43b Mon Sep 17 00:00:00 2001 From: ahmedaly113 <60133587+ahmedaly113@users.noreply.github.com> Date: Fri, 29 May 2020 07:07:12 +1000 Subject: [PATCH] fix #6287 sending multiple transactions from an account make nonce sequence stuck (#6291) * fix #6287 sending multiple transactions from an account make nonce sequence stuck * add change log * fix ante unit test after #6287 fix * Update x/auth/ante/sigverify.go Co-authored-by: Alessio Treglia Co-authored-by: Alessio Treglia Co-authored-by: Alexander Bezobchuk --- CHANGELOG.md | 1 + x/auth/ante/sigverify.go | 5 ----- x/auth/ante/sigverify_test.go | 8 ++++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 587d76ec11..94ea5facfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -147,6 +147,7 @@ invalid or incomplete requests. * (x/genutil) [\#5938](https://github.com/cosmos/cosmos-sdk/pull/5938) Fix `InitializeNodeValidatorFiles` error handling. * (x/staking) [\#5949](https://github.com/cosmos/cosmos-sdk/pull/5949) Skip staking `HistoricalInfoKey` in simulations as headers are not exported. * (client) [\#5964](https://github.com/cosmos/cosmos-sdk/issues/5964) `--trust-node` is now false by default - for real. Users must ensure it is set to true if they don't want to enable the verifier. +* (x/auth) [\#6291](https://github.com/cosmos/cosmos-sdk/pull/6291) Fix nonce stuck issue when sending multiple transactions from an account in a same block. Issue behavior is "unauthorized: signature verification failed" for correctly signed transaction. ### State Machine Breaking diff --git a/x/auth/ante/sigverify.go b/x/auth/ante/sigverify.go index 0b17b05bc4..a217fad06c 100644 --- a/x/auth/ante/sigverify.go +++ b/x/auth/ante/sigverify.go @@ -234,11 +234,6 @@ func NewIncrementSequenceDecorator(ak AccountKeeper) IncrementSequenceDecorator } func (isd IncrementSequenceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { - // no need to increment sequence on RecheckTx - if ctx.IsReCheckTx() && !simulate { - return next(ctx, tx, simulate) - } - sigTx, ok := tx.(SigVerifiableTx) if !ok { return ctx, sdkerrors.Wrap(sdkerrors.ErrTxDecode, "invalid transaction type") diff --git a/x/auth/ante/sigverify_test.go b/x/auth/ante/sigverify_test.go index f60ca03935..6d83318c14 100644 --- a/x/auth/ante/sigverify_test.go +++ b/x/auth/ante/sigverify_test.go @@ -236,11 +236,11 @@ func TestIncrementSequenceDecorator(t *testing.T) { simulate bool expectedSeq uint64 }{ - {ctx.WithIsReCheckTx(true), false, 0}, - {ctx.WithIsCheckTx(true).WithIsReCheckTx(false), false, 1}, {ctx.WithIsReCheckTx(true), false, 1}, - {ctx.WithIsReCheckTx(true), false, 1}, - {ctx.WithIsReCheckTx(true), true, 2}, + {ctx.WithIsCheckTx(true).WithIsReCheckTx(false), false, 2}, + {ctx.WithIsReCheckTx(true), false, 3}, + {ctx.WithIsReCheckTx(true), false, 4}, + {ctx.WithIsReCheckTx(true), true, 5}, } for i, tc := range testCases {