@@ -188,6 +188,7 @@ const (
188188
189189 FlagBlockedAddresses = "blocked-addresses"
190190 FlagUnsafeIgnoreBlockListFailure = "unsafe-ignore-block-list-failure"
191+ FlagUnsafeDummyCheckTx = "unsafe-dummy-check-tx"
191192)
192193
193194var Forks = []Fork {}
@@ -289,6 +290,7 @@ type App struct {
289290 // encoding
290291 cdc * codec.LegacyAmino
291292 txConfig client.TxConfig
293+ txDecoder sdk.TxDecoder
292294 appCodec codec.Codec
293295 interfaceRegistry types.InterfaceRegistry
294296
@@ -352,6 +354,9 @@ type App struct {
352354 qms storetypes.RootMultiStore
353355
354356 blockProposalHandler * ProposalHandler
357+
358+ // unsafe to set for validator, used for testing
359+ dummyCheckTx bool
355360}
356361
357362// New returns a reference to an initialized chain.
@@ -456,6 +461,7 @@ func New(
456461 BaseApp : bApp ,
457462 cdc : cdc ,
458463 txConfig : txConfig ,
464+ txDecoder : txDecoder ,
459465 appCodec : appCodec ,
460466 interfaceRegistry : interfaceRegistry ,
461467 invCheckPeriod : invCheckPeriod ,
@@ -464,6 +470,7 @@ func New(
464470 okeys : okeys ,
465471 memKeys : memKeys ,
466472 blockProposalHandler : blockProposalHandler ,
473+ dummyCheckTx : cast .ToBool (appOpts .Get (FlagUnsafeDummyCheckTx )),
467474 }
468475
469476 app .SetDisableBlockGasMeter (true )
@@ -1466,3 +1473,21 @@ func (app *App) Close() error {
14661473func maxParallelism () int {
14671474 return min (stdruntime .GOMAXPROCS (0 ), stdruntime .NumCPU ())
14681475}
1476+
1477+ func (app * App ) CheckTx (req * abci.RequestCheckTx ) (* abci.ResponseCheckTx , error ) {
1478+ if app .dummyCheckTx {
1479+ tx , err := app .txDecoder (req .Tx )
1480+ if err != nil {
1481+ return nil , err
1482+ }
1483+
1484+ feeTx , ok := tx .(sdk.FeeTx )
1485+ if ! ok {
1486+ return nil , errors .Wrap (sdkerrors .ErrInvalidRequest , "tx must be FeeTx" )
1487+ }
1488+
1489+ return & abci.ResponseCheckTx {Code : abci .CodeTypeOK , GasWanted : int64 (feeTx .GetGas ())}, nil
1490+ }
1491+
1492+ return app .BaseApp .CheckTx (req )
1493+ }
0 commit comments