Skip to content

Commit

Permalink
perf: Make recheck not re-run validate basic (cosmos#20208)
Browse files Browse the repository at this point in the history
  • Loading branch information
ValarDragon authored Apr 29, 2024
1 parent 84712ed commit 92ae885
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 6 additions & 2 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 92ae885

Please sign in to comment.