From cb1627ef7ffc539a24a91090bb65fd8f7dbf2a9c Mon Sep 17 00:00:00 2001 From: Cosmic Vagabond <121588426+cosmic-vagabond@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:58:47 +0200 Subject: [PATCH] docs: add debug mode doc --- scripts/upgrade-assure/README.md | 8 ++++++++ scripts/upgrade-assure/start.go | 8 +++++++- x/epochs/keeper/abci.go | 4 ++-- x/leveragelp/keeper/position_close.go | 3 --- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade-assure/README.md b/scripts/upgrade-assure/README.md index 370a6b52c..15ef795dc 100644 --- a/scripts/upgrade-assure/README.md +++ b/scripts/upgrade-assure/README.md @@ -156,3 +156,11 @@ Run the following command to start the nodes manually: ```bash go run ./scripts/upgrade-assure/... /tmp/snapshot.tar.lz4 ~/go/bin/elysd ~/go/bin/elysd --only-start-with-new-binary ``` + +**Debug Mode** + +By default the nodes run in `info` mode. To enable debug mode, add the following flag to the command: + +```bash +LOG_LEVEL=debug go run ./scripts/upgrade-assure/... /tmp/snapshot.tar.lz4 ~/go/bin/elysd ~/go/bin/elysd --only-start-with-new-binary +``` diff --git a/scripts/upgrade-assure/start.go b/scripts/upgrade-assure/start.go index 18c6fcadf..c8b64be93 100644 --- a/scripts/upgrade-assure/start.go +++ b/scripts/upgrade-assure/start.go @@ -26,8 +26,14 @@ func (cw PromptWriter) Write(data []byte) (int, error) { } func start(cmdPath, homePath, rpc, p2p, pprof, api, moniker, successColor, errorColor string) *exec.Cmd { + // Set the log level + logLevel := "info" + if os.Getenv("LOG_LEVEL") != "" { + logLevel = os.Getenv("LOG_LEVEL") + } + // Command and arguments - args := []string{"start", "--home", homePath, "--rpc.laddr", rpc, "--p2p.laddr", p2p, "--rpc.pprof_laddr", pprof, "--api.address", api} + args := []string{"start", "--home", homePath, "--rpc.laddr", rpc, "--p2p.laddr", p2p, "--rpc.pprof_laddr", pprof, "--api.address", api, "--log_level", logLevel} // Set up the command cmd := exec.Command(cmdPath, args...) diff --git a/x/epochs/keeper/abci.go b/x/epochs/keeper/abci.go index 7f2e7405b..e9659828f 100644 --- a/x/epochs/keeper/abci.go +++ b/x/epochs/keeper/abci.go @@ -29,11 +29,11 @@ func (k Keeper) BeginBlocker(ctx sdk.Context) { case shouldInitialEpochStart: epochInfo.StartInitialEpoch() - logger.Info("starting epoch", "identifier", epochInfo.Identifier) + logger.Debug("starting epoch", "identifier", epochInfo.Identifier) case shouldEpochEnd: epochInfo.EndEpoch() - logger.Info("ending epoch", "identifier", epochInfo.Identifier) + logger.Debug("ending epoch", "identifier", epochInfo.Identifier) ctx.EventManager().EmitEvent( sdk.NewEvent( diff --git a/x/leveragelp/keeper/position_close.go b/x/leveragelp/keeper/position_close.go index da798ce33..5bcde6151 100644 --- a/x/leveragelp/keeper/position_close.go +++ b/x/leveragelp/keeper/position_close.go @@ -27,9 +27,6 @@ func (k Keeper) ForceCloseLong(ctx sdk.Context, position types.Position, pool ty } repayAmount := debt.Borrowed.Add(debt.InterestStacked).Sub(debt.InterestPaid).Mul(lpAmount).Quo(position.LeveragedLpAmount) - if err != nil { - return sdk.ZeroInt(), err - } err = k.stableKeeper.Repay(ctx, position.GetPositionAddress(), sdk.NewCoin(position.Collateral.Denom, repayAmount)) if err != nil {