Skip to content

Commit

Permalink
Merge PR cosmos#4810: CheckTx msg routing
Browse files Browse the repository at this point in the history
  • Loading branch information
fedekunze authored and alexanderbez committed Jul 30, 2019
1 parent 4d5d2f7 commit 1765613
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions .pending/bugfixes/abci/_4639-checktx-verify
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#4639 Fix `CheckTx` by verifying the message route
12 changes: 4 additions & 8 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,8 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg
}

// CheckTx implements the ABCI interface. It runs the "basic checks" to see
// whether or not a transaction can possibly be executed, first decoding, then
// the ante handler (which checks signatures/fees/ValidateBasic), then finally
// the route match to see whether a handler exists.
// whether or not a transaction can possibly be executed, first decoding and then
// the ante handler (which checks signatures/fees/ValidateBasic).
//
// NOTE:CheckTx does not run the actual Msg handler function(s).
func (app *BaseApp) CheckTx(req abci.RequestCheckTx) (res abci.ResponseCheckTx) {
Expand Down Expand Up @@ -906,17 +905,14 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx) (result sdk
msCache.Write()
}

if mode == runTxModeCheck {
return result
}

// Create a new context based off of the existing context with a cache wrapped
// multi-store in case message processing fails.
runMsgCtx, msCache := app.cacheTxContext(ctx, txBytes)
result = app.runMsgs(runMsgCtx, msgs, mode)
result.GasWanted = gasWanted

if mode == runTxModeSimulate {
// Safety check: don't write the cache state unless we're in DeliverTx.
if mode != runTxModeDeliver {
return result
}

Expand Down

0 comments on commit 1765613

Please sign in to comment.