From 17656137188330f6f9af0e50f7fce1f7441f5f4a Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Tue, 30 Jul 2019 18:11:09 +0200 Subject: [PATCH] Merge PR #4810: CheckTx msg routing --- .pending/bugfixes/abci/_4639-checktx-verify | 1 + baseapp/baseapp.go | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 .pending/bugfixes/abci/_4639-checktx-verify diff --git a/.pending/bugfixes/abci/_4639-checktx-verify b/.pending/bugfixes/abci/_4639-checktx-verify new file mode 100644 index 000000000000..8441c5cfb39c --- /dev/null +++ b/.pending/bugfixes/abci/_4639-checktx-verify @@ -0,0 +1 @@ +#4639 Fix `CheckTx` by verifying the message route diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index b086737b7ed5..b5778ecd2ec0 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -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) { @@ -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 }