From 9f7fdfbb6ff86b3f81eacca2f7238bfcecb8510a Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Tue, 30 Jul 2019 16:02:44 +0200 Subject: [PATCH 1/4] remove tx mode check from baseapp --- baseapp/baseapp.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index b086737b7ed5..b9b3b382154a 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,10 +905,6 @@ 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) From ae1e39fa559a7114832c42aa0c7ff7f65a3f1471 Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Tue, 30 Jul 2019 16:04:37 +0200 Subject: [PATCH 2/4] clog --- .pending/bugfixes/abci/_4639-checktx-verify | 1 + 1 file changed, 1 insertion(+) 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..c1371e0be2bd --- /dev/null +++ b/.pending/bugfixes/abci/_4639-checktx-verify @@ -0,0 +1 @@ +#4639 `CheckTx` doesn't verify the message route \ No newline at end of file From 9004402a8cad80b283250d38447ffaa73b5c905d Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Tue, 30 Jul 2019 08:09:52 -0700 Subject: [PATCH 3/4] Update .pending/bugfixes/abci/_4639-checktx-verify --- .pending/bugfixes/abci/_4639-checktx-verify | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pending/bugfixes/abci/_4639-checktx-verify b/.pending/bugfixes/abci/_4639-checktx-verify index c1371e0be2bd..8441c5cfb39c 100644 --- a/.pending/bugfixes/abci/_4639-checktx-verify +++ b/.pending/bugfixes/abci/_4639-checktx-verify @@ -1 +1 @@ -#4639 `CheckTx` doesn't verify the message route \ No newline at end of file +#4639 Fix `CheckTx` by verifying the message route From c26773cb2997150736d0529ea44156c92a43f9f2 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 30 Jul 2019 11:31:40 -0400 Subject: [PATCH 4/4] Add safety check --- baseapp/baseapp.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index b9b3b382154a..b5778ecd2ec0 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -911,7 +911,8 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte, tx sdk.Tx) (result sdk 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 }