perf: Make recheck not re-run validate basic (#20208)

This commit is contained in:
Dev Ojha 2024-04-29 01:13:40 -07:00 committed by GitHub
parent 84712ede65
commit 92ae8850e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -94,6 +94,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (x/genutil) [#19735](https://github.com/cosmos/cosmos-sdk/pull/19735) Update genesis api to match new `appmodule.HasGenesis` interface.
* (server) [#19966](https://github.com/cosmos/cosmos-sdk/pull/19966) Return BlockHeader by shallow copy in server Context.
* (proto) [#20098](https://github.com/cosmos/cosmos-sdk/pull/20098) Use cosmos_proto added_in annotation instead of // Since comments.
* (baseapp) [#20208](https://github.com/cosmos/cosmos-sdk/pull/20208) Skip running validateBasic for rechecking txs.
### Bug Fixes

View File

@ -871,8 +871,12 @@ func (app *BaseApp) runTx(mode execMode, txBytes []byte) (gInfo sdk.GasInfo, res
}
msgs := tx.GetMsgs()
if err := validateBasicTxMsgs(app.msgServiceRouter, 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(app.msgServiceRouter, msgs); err != nil {
return sdk.GasInfo{}, nil, nil, err
}
}
if app.anteHandler != nil {