@@ -111,6 +111,8 @@ type BaseApp struct { //nolint: maligned
111111	// abciListeners for hooking into the ABCI message processing of the BaseApp 
112112	// and exposing the requests and responses to external consumers 
113113	abciListeners  []ABCIListener 
114+ 
115+ 	LastTxManager  LastMsgMarkerContainer 
114116}
115117
116118type  appStore  struct  {
@@ -742,8 +744,12 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode runTxMode) (*s
742744		Data : make ([]* sdk.MsgData , 0 , len (msgs )),
743745	}
744746
747+ 	// Set the marker as false - future messages may toggle this flag 
748+ 	app .LastTxManager .SetMarker (false )
749+ 
745750	// NOTE: GasWanted is determined by the AnteHandler and GasUsed by the GasMeter. 
746751	for  i , msg  :=  range  msgs  {
752+ 
747753		// skip actual execution for (Re)CheckTx mode 
748754		if  mode  ==  runTxModeCheck  ||  mode  ==  runTxModeReCheck  {
749755			break 
@@ -755,6 +761,10 @@ func (app *BaseApp) runMsgs(ctx sdk.Context, msgs []sdk.Msg, mode runTxMode) (*s
755761			err           error 
756762		)
757763
764+ 		if  app .LastTxManager .GetMarker () {
765+ 			return  nil , sdkerrors .Wrapf (sdkerrors .ErrLastTx , "message was attempted but last message was marked by a contract; message index: %d" , i )
766+ 		}
767+ 
758768		if  handler  :=  app .msgServiceRouter .Handler (msg ); handler  !=  nil  {
759769			// ADR 031 request type routing 
760770			msgResult , err  =  handler (ctx , msg )
0 commit comments