@@ -213,33 +213,38 @@ func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBloc
213
213
func (app * BaseApp ) CheckTx (req abci.RequestCheckTx ) abci.ResponseCheckTx {
214
214
defer telemetry .MeasureSince (time .Now (), "abci" , "check_tx" )
215
215
216
- var mode runTxMode
217
-
218
- switch {
219
- case req .Type == abci .CheckTxType_New :
220
- mode = runTxModeCheck
221
-
222
- case req .Type == abci .CheckTxType_Recheck :
223
- mode = runTxModeReCheck
216
+ tx , err := app .txDecoder (req .Tx )
217
+ if err != nil {
218
+ return sdkerrors .ResponseCheckTx (err , 0 , 0 , app .trace )
219
+ }
224
220
225
- default :
221
+ if req . Type != abci . CheckTxType_New && req . Type != abci . CheckTxType_Recheck {
226
222
panic (fmt .Sprintf ("unknown RequestCheckTx type: %s" , req .Type ))
227
223
}
228
224
229
- gInfo , result , err := app .runTx ( mode , req .Tx )
225
+ gInfo , err := app .checkTx ( req . Tx , tx , req .Type == abci . CheckTxType_Recheck )
230
226
if err != nil {
231
227
return sdkerrors .ResponseCheckTx (err , gInfo .GasWanted , gInfo .GasUsed , app .trace )
232
228
}
233
229
234
230
return abci.ResponseCheckTx {
235
231
GasWanted : int64 (gInfo .GasWanted ), // TODO: Should type accept unsigned ints?
236
232
GasUsed : int64 (gInfo .GasUsed ), // TODO: Should type accept unsigned ints?
237
- Log : result .Log ,
238
- Data : result .Data ,
239
- Events : sdk .MarkEventsToIndex (result .Events , app .indexEvents ),
240
233
}
241
234
}
242
235
236
+ // BeginRecheckTx implements the ABCI interface and set the check state based on the given header
237
+ func (app * BaseApp ) BeginRecheckTx (req abci.RequestBeginRecheckTx ) abci.ResponseBeginRecheckTx {
238
+ // NOTE: This is safe because Ostracon holds a lock on the mempool for Rechecking.
239
+ app .setCheckState (req .Header )
240
+ return abci.ResponseBeginRecheckTx {Code : abci .CodeTypeOK }
241
+ }
242
+
243
+ // EndRecheckTx implements the ABCI interface.
244
+ func (app * BaseApp ) EndRecheckTx (req abci.RequestEndRecheckTx ) abci.ResponseEndRecheckTx {
245
+ return abci.ResponseEndRecheckTx {Code : abci .CodeTypeOK }
246
+ }
247
+
243
248
// DeliverTx implements the ABCI interface and executes a tx in DeliverTx mode.
244
249
// State only gets persisted if all messages are valid and get executed successfully.
245
250
// Otherwise, the ResponseDeliverTx will contain releveant error information.
@@ -258,7 +263,12 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx
258
263
telemetry .SetGauge (float32 (gInfo .GasWanted ), "tx" , "gas" , "wanted" )
259
264
}()
260
265
261
- gInfo , result , err := app .runTx (runTxModeDeliver , req .Tx )
266
+ tx , err := app .txDecoder (req .Tx )
267
+ if err != nil {
268
+ return sdkerrors .ResponseDeliverTx (err , 0 , 0 , app .trace )
269
+ }
270
+
271
+ gInfo , result , err := app .runTx (req .Tx , tx , false )
262
272
if err != nil {
263
273
resultStr = "failed"
264
274
return sdkerrors .ResponseDeliverTx (err , gInfo .GasWanted , gInfo .GasUsed , app .trace )
@@ -275,11 +285,10 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx
275
285
276
286
// Commit implements the ABCI interface. It will commit all state that exists in
277
287
// the deliver state's multi-store and includes the resulting commit ID in the
278
- // returned abci.ResponseCommit. Commit will set the check state based on the
279
- // latest header and reset the deliver state. Also, if a non-zero halt height is
280
- // defined in config, Commit will execute a deferred function call to check
281
- // against that height and gracefully halt if it matches the latest committed
282
- // height.
288
+ // returned abci.ResponseCommit. Commit will reset the deliver state.
289
+ // Also, if a non-zero halt height is defined in config, Commit will execute
290
+ // a deferred function call to check against that height and gracefully halt if
291
+ // it matches the latest committed height.
283
292
func (app * BaseApp ) Commit () (res abci.ResponseCommit ) {
284
293
defer telemetry .MeasureSince (time .Now (), "abci" , "commit" )
285
294
@@ -293,12 +302,6 @@ func (app *BaseApp) Commit() (res abci.ResponseCommit) {
293
302
commitID := app .cms .Commit ()
294
303
app .logger .Info ("commit synced" , "commit" , fmt .Sprintf ("%X" , commitID ))
295
304
296
- // Reset the Check state to the latest committed.
297
- //
298
- // NOTE: This is safe because Tendermint holds a lock on the mempool for
299
- // Commit. Use the header from this latest block.
300
- app .setCheckState (header )
301
-
302
305
// empty/reset the deliver state
303
306
app .deliverState = nil
304
307
0 commit comments