From 4da68dad998cccf46dca04e707179a1a4aa606b3 Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Mon, 29 Apr 2024 01:13:40 -0700 Subject: [PATCH] perf: Make recheck not re-run validate basic (#20208) --- CHANGELOG.md | 1 + baseapp/baseapp.go | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ba20e167f9e..47d92c70cf65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements * (server) [#21941](https://github.com/cosmos/cosmos-sdk/pull/21941) Regenerate addrbook.json for in place testnet. +* (baseapp) [#20208](https://github.com/cosmos/cosmos-sdk/pull/20208) Skip running validateBasic for rechecking txs. ### Bug Fixes diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 3e859f91c395..f7952215dc65 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -915,8 +915,12 @@ func (app *BaseApp) runTxWithMultiStore( } msgs := tx.GetMsgs() - if err := validateBasicTxMsgs(msgs); err != nil { - return sdk.GasInfo{}, nil, nil, err + // run validate basic if mode != recheck. + // as validate basic is stateless, it is guaranteed to pass recheck, given that its passed checkTx. + if mode != execModeReCheck { + if err := validateBasicTxMsgs(msgs); err != nil { + return sdk.GasInfo{}, nil, nil, err + } } for _, msg := range msgs {