Merge PR #4810: CheckTx msg routing
This commit is contained in:
parent
4d5d2f7f5d
commit
1765613718
|
@ -0,0 +1 @@
|
||||||
|
#4639 Fix `CheckTx` by verifying the message route
|
|
@ -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
|
// CheckTx implements the ABCI interface. It runs the "basic checks" to see
|
||||||
// whether or not a transaction can possibly be executed, first decoding, then
|
// whether or not a transaction can possibly be executed, first decoding and then
|
||||||
// the ante handler (which checks signatures/fees/ValidateBasic), then finally
|
// the ante handler (which checks signatures/fees/ValidateBasic).
|
||||||
// the route match to see whether a handler exists.
|
|
||||||
//
|
//
|
||||||
// NOTE:CheckTx does not run the actual Msg handler function(s).
|
// NOTE:CheckTx does not run the actual Msg handler function(s).
|
||||||
func (app *BaseApp) CheckTx(req abci.RequestCheckTx) (res abci.ResponseCheckTx) {
|
func (app *BaseApp) CheckTx(req abci.RequestCheckTx) (res abci.ResponseCheckTx) {
|
||||||
|
@ -906,17 +905,14 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx) (result sdk
|
||||||
msCache.Write()
|
msCache.Write()
|
||||||
}
|
}
|
||||||
|
|
||||||
if mode == runTxModeCheck {
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new context based off of the existing context with a cache wrapped
|
// Create a new context based off of the existing context with a cache wrapped
|
||||||
// multi-store in case message processing fails.
|
// multi-store in case message processing fails.
|
||||||
runMsgCtx, msCache := app.cacheTxContext(ctx, txBytes)
|
runMsgCtx, msCache := app.cacheTxContext(ctx, txBytes)
|
||||||
result = app.runMsgs(runMsgCtx, msgs, mode)
|
result = app.runMsgs(runMsgCtx, msgs, mode)
|
||||||
result.GasWanted = gasWanted
|
result.GasWanted = gasWanted
|
||||||
|
|
||||||
if mode == runTxModeSimulate {
|
// Safety check: don't write the cache state unless we're in DeliverTx.
|
||||||
|
if mode != runTxModeDeliver {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue