From a3d66328d79f65ff290c143c173af3410ec5174f Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 27 Jun 2023 13:36:39 +0000 Subject: [PATCH] feat: make abci handshake graceful interruptible (backport #16206) (#16710) Co-authored-by: yihuang --- CHANGELOG.md | 1 + server/start.go | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0097e2c403..d867ae25de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (all) [#16497](https://github.com/cosmos/cosmos-sdk/pull/16497) Removed all exported vestiges of `sdk.MustSortJSON` and `sdk.SortJSON`. * (x/distribution) [#16218](https://github.com/cosmos/cosmos-sdk/pull/16218) Add Autocli config to distribution module. +* (cli) [#16206](https://github.com/cosmos/cosmos-sdk/pull/16206) Make ABCI handshake profileable. ### Bug Fixes diff --git a/server/start.go b/server/start.go index bd9c71f6d4..0764f454c6 100644 --- a/server/start.go +++ b/server/start.go @@ -288,13 +288,15 @@ func startInProcess(svrCtx *Context, svrCfg serverconfig.Config, clientCtx clien gRPCOnly := svrCtx.Viper.GetBool(flagGRPCOnly) + g, ctx := getCtx(svrCtx, true) + if gRPCOnly { // TODO: Generalize logic so that gRPC only is really in startStandAlone svrCtx.Logger.Info("starting node in gRPC only mode; CometBFT is disabled") svrCfg.GRPC.Enable = true } else { svrCtx.Logger.Info("starting node with ABCI CometBFT in-process") - tmNode, cleanupFn, err := startCmtNode(cmtCfg, app, svrCtx) + tmNode, cleanupFn, err := startCmtNode(ctx, cmtCfg, app, svrCtx) if err != nil { return err } @@ -314,8 +316,6 @@ func startInProcess(svrCtx *Context, svrCfg serverconfig.Config, clientCtx clien } } - g, ctx := getCtx(svrCtx, true) - grpcSrv, clientCtx, err := startGrpcServer(ctx, g, svrCfg.GRPC, clientCtx, svrCtx, app) if err != nil { return err @@ -339,6 +339,7 @@ func startInProcess(svrCtx *Context, svrCfg serverconfig.Config, clientCtx clien // TODO: Move nodeKey into being created within the function. func startCmtNode( + ctx context.Context, cfg *cmtcfg.Config, app types.Application, svrCtx *Context, @@ -349,7 +350,8 @@ func startCmtNode( } cmtApp := NewCometABCIWrapper(app) - tmNode, err = node.NewNode( + tmNode, err = node.NewNodeWithContext( + ctx, cfg, pvm.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile()), nodeKey,