func (app *BaseApp) Commit() (res abci.ResponseCommit) {
	header := app.deliverState.ctx.BlockHeader()
	app.deliverState.ms.Write()
	commitID := app.cms.Commit()
	app.logger.Debug("Commit synced", "commit", fmt.Sprintf("%X", commitID))
	app.setCheckState(header)
	app.deliverState = nil
	defer func() {
		if app.haltHeight > 0 && uint64(header.Height) == app.haltHeight {
			app.Log("halting node per configuration height:%d", app.haltHeight)
			os.Exit(0)
		}
	}()
	return abci.ResponseCommit{
		Data: commitID.Hash,
	}
}
Commit implements the ABCI interface. It will commit all state that exists in
the deliver state's multi-store and includes the resulting commit ID in the
returned abci.ResponseCommit. Commit will set the check state based on the
latest header and reset the deliver state. Also, if a non-zero halt height is
defined in config, Commit will execute a deferred function call to check
against that height and gracefully halt if it matches the latest committed
height.
package baseapp
import (
	"fmt"
	"os"
	"sort"
	"strings"
	abci "github.com/tendermint/tendermint/abci/types"
	"github.com/Dipper-Labs/Dipper-Protocol/codec"
	sdk "github.com/Dipper-Labs/Dipper-Protocol/types"
	sdkerrors "github.com/Dipper-Labs/Dipper-Protocol/types/errors"
	"github.com/Dipper-Labs/Dipper-Protocol/version"
)
func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain) {
	if req.ConsensusParams != nil {
		app.setConsensusParams(req.ConsensusParams)
		app.storeConsensusParams(req.ConsensusParams)
	}
	initHeader := abci.Header{ChainID: req.ChainId, Time: req.Time}
	app.setDeliverState(initHeader)
	app.setCheckState(initHeader)
	initChainer := app.Engine.GetCurrentProtocol().GetInitChainer()
	if initChainer == nil {
		return
	}
	app.deliverState.ctx = app.deliverState.ctx.WithBlockGasMeter(sdk.NewInfiniteGasMeter())
	res = initChainer(app.deliverState.ctx, req)
	if len(req.Validators) > 0 {
		if len(req.Validators) != len(res.Validators) {
			panic(
				fmt.Errorf(
					"len(RequestInitChain.Validators) != len(GenesisValidators) (%d != %d)",
					len(req.Validators), len(res.Validators),
				),
			)
		}
		sort.Sort(abci.ValidatorUpdates(req.Validators))
		sort.Sort(abci.ValidatorUpdates(res.Validators))
		for i, val := range res.Validators {
			if !val.Equal(req.Validators[i]) {
				panic(fmt.Errorf("genesisValidators[%d] != req.Validators[%d] ", i, i))
			}
		}
	}
	return res
}
func (app *BaseApp) Info(req abci.RequestInfo) abci.ResponseInfo {
	lastCommitID := app.cms.LastCommitID()
	return abci.ResponseInfo{
		AppVersion:       version.AppVersion,
		Data:             app.name,
		LastBlockHeight:  lastCommitID.Version,
		LastBlockAppHash: lastCommitID.Hash,
	}
}
func (app *BaseApp) SetOption(req abci.RequestSetOption) (res abci.ResponseSetOption) {
	return
}
func (app *BaseApp) FilterPeerByAddrPort(info string) abci.ResponseQuery {
	if app.addrPeerFilter != nil {
		return app.addrPeerFilter(info)
	}
	return abci.ResponseQuery{}
}
func (app *BaseApp) FilterPeerByID(info string) abci.ResponseQuery {
	if app.idPeerFilter != nil {
		return app.idPeerFilter(info)
	}
	return abci.ResponseQuery{}
}
func splitPath(requestPath string) (path []string) {
	path = strings.Split(requestPath, "/")
	if len(path) > 0 && path[0] == "" {
		path = path[1:]
	}
	return path
}
func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock) {
	if app.cms.TracingEnabled() {
		app.cms.SetTracingContext(sdk.TraceContext(
			map[string]interface{}{"blockHeight": req.Header.Height},
		))
	}
	if err := app.validateHeight(req); err != nil {
		panic(err)
	}
	if app.deliverState == nil {
		app.setDeliverState(req.Header)
	} else {
		app.deliverState.ctx = app.deliverState.ctx.
			WithBlockHeader(req.Header).
			WithBlockHeight(req.Header.Height)
	}
	var gasMeter sdk.GasMeter
	if maxGas := app.getMaximumBlockGas(); maxGas > 0 {
		gasMeter = sdk.NewGasMeter(maxGas)
	} else {
		gasMeter = sdk.NewInfiniteGasMeter()
	}
	app.deliverState.ctx = app.deliverState.ctx.WithBlockGasMeter(gasMeter)
	beginBlocker := app.Engine.GetCurrentProtocol().GetBeginBlocker()
	if beginBlocker != nil {
		res = beginBlocker(app.deliverState.ctx, req)
	}
	app.voteInfos = req.LastCommitInfo.GetVotes()
	return res
}
func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBlock) {
	if app.deliverState.ms.TracingEnabled() {
		app.deliverState.ms = app.deliverState.ms.SetTracingContext(nil).(sdk.CacheMultiStore)
	}
	endBlocker := app.Engine.GetCurrentProtocol().GetEndBlocker()
	if endBlocker != nil {
		res = endBlocker(app.deliverState.ctx, req)
	}
	if app.PostEndBlocker != nil {
		app.PostEndBlocker(&res)
	}
	return res
}
func (app *BaseApp) CheckTx(req abci.RequestCheckTx) (res abci.ResponseCheckTx) {
	tx, err := app.txDecoder(req.Tx)
	if err != nil {
		return sdkerrors.ResponseCheckTx(err, 0, 0)
	}
	var mode runTxMode
	switch {
	case req.Type == abci.CheckTxType_New:
		mode = runTxModeCheck
	case req.Type == abci.CheckTxType_Recheck:
		mode = runTxModeReCheck
	default:
		panic(fmt.Sprintf("unknown RequestCheckTx type: %s", req.Type))
	}
	gInfo, result, err := app.runTx(mode, req.Tx, tx)
	if err != nil {
		return sdkerrors.ResponseCheckTx(err, gInfo.GasWanted, gInfo.GasUsed)
	}
	return abci.ResponseCheckTx{
		GasWanted: int64(gInfo.GasWanted),
		GasUsed:   int64(gInfo.GasUsed),
		Log:       result.Log,
		Data:      result.Data,
		Events:    result.Events.ToABCIEvents(),
	}
}
func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) {
	tx, err := app.txDecoder(req.Tx)
	if err != nil {
		return sdkerrors.ResponseDeliverTx(err, nil, 0, 0, err.Error())
	}
	gInfo, result, err := app.runTx(runTxModeDeliver, req.Tx, tx)
	if err != nil {
		log := err.Error()
		if result != nil {
			log = result.Log
		}
		var data []byte
		if result != nil {
			data = append(data, result.Data...)
		}
		return sdkerrors.ResponseDeliverTx(err, data, gInfo.GasWanted, gInfo.GasUsed, log)
	}
	return abci.ResponseDeliverTx{
		GasWanted: int64(gInfo.GasWanted),
		GasUsed:   int64(gInfo.GasUsed),
		Log:       result.Log,
		Data:      result.Data,
		Events:    result.Events.ToABCIEvents(),
	}
}