From defc6a3e4dedd3f2bbed1af47d8f08dbb92ed3bf Mon Sep 17 00:00:00 2001 From: Julian Strobl Date: Tue, 19 Dec 2023 14:28:15 +0100 Subject: [PATCH] Fix typo and align log messages (#241) * Fix typo and align log messages * Align some variable names with rest of the program * [log] Fix log formatting and change log level * Fix comment Signed-off-by: Julian Strobl --- app/ante/check_reissuance_decorator.go | 4 ++-- cmd/planetmint-god/cmd/root.go | 14 +++++++------- config/config.go | 2 +- util/issue_commands.go | 2 +- x/dao/keeper/reissuance.go | 9 +++++---- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/app/ante/check_reissuance_decorator.go b/app/ante/check_reissuance_decorator.go index 6f27be5..9359baa 100644 --- a/app/ante/check_reissuance_decorator.go +++ b/app/ante/check_reissuance_decorator.go @@ -22,10 +22,10 @@ func (cmad CheckReissuanceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu if sdk.MsgTypeURL(msg) == "/planetmintgo.dao.MsgReissueRDDLProposal" { MsgProposal, ok := msg.(*daotypes.MsgReissueRDDLProposal) if ok { - util.GetAppLogger().Debug(ctx, "ante handler - received re-issuance roposal") + util.GetAppLogger().Debug(ctx, "ante handler - received re-issuance proposal") isValid := cmad.dk.IsValidReIssuanceProposal(ctx, MsgProposal) if !isValid { - util.GetAppLogger().Info(ctx, "ante handler: rejected re-issuance proposal") + util.GetAppLogger().Info(ctx, "ante handler - rejected re-issuance proposal") return ctx, errorsmod.Wrapf(daotypes.ErrReissuanceProposal, "error during CheckTx or ReCheckTx") } util.GetAppLogger().Debug(ctx, "ante handler - accepted re-issuance proposal") diff --git a/cmd/planetmint-god/cmd/root.go b/cmd/planetmint-god/cmd/root.go index 393eef4..8e6bfbe 100644 --- a/cmd/planetmint-god/cmd/root.go +++ b/cmd/planetmint-god/cmd/root.go @@ -359,7 +359,7 @@ func initAppConfig(clientCtx client.Context) (string, interface{}) { type CustomAppConfig struct { serverconfig.Config PlmntConfig planetmintconfig.Config - RPCConfig lib.Config + LibConfig lib.Config } // Optionally allow the chain developer to overwrite the SDK's default @@ -379,16 +379,16 @@ func initAppConfig(clientCtx client.Context) (string, interface{}) { // In simapp, we set the min gas prices to 0. srvCfg.MinGasPrices = "0stake" - plmntCfg := planetmintconfig.GetConfig() - plmntCfg.SetRoot(clientCtx.HomeDir) + plmntConfig := planetmintconfig.GetConfig() + plmntConfig.SetRoot(clientCtx.HomeDir) - rpcCfg := lib.GetConfig() - rpcCfg.SetChainID(clientCtx.ChainID) + libConfig := lib.GetConfig() + libConfig.SetChainID(clientCtx.ChainID) customAppConfig := CustomAppConfig{ Config: *srvCfg, - PlmntConfig: *plmntCfg, - RPCConfig: *rpcCfg, + PlmntConfig: *plmntConfig, + LibConfig: *libConfig, } customAppTemplate := serverconfig.DefaultConfigTemplate + planetmintconfig.DefaultConfigTemplate diff --git a/config/config.go b/config/config.go index 7a9ee21..f7e40c8 100644 --- a/config/config.go +++ b/config/config.go @@ -94,7 +94,7 @@ func DefaultConfig() *Config { DistributionAddrInv: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG", DistributionAddrDAO: "vjU8eMzU3JbUWZEpVANt2ePJuPWSPixgjiSj2jDMvkVVQQi2DDnZuBRVX4Ygt5YGBf5zvTWCr1ntdqYH", DistributionAddrPop: "vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD", - DistributionEpochs: 17640, // CometBFT epochs of 5s equate 1 day (12*60*24) + 15 min (15*24) to wait for confirmations on the re-issuance + DistributionEpochs: 17640, // CometBFT epochs of 5s equate 1 day (12*60*24) + 30 min (12*30) to wait for confirmations on the re-issuance ReIssuanceEpochs: 17280, // CometBFT epochs of 5s equate 1 day (12*60*24) } } diff --git a/util/issue_commands.go b/util/issue_commands.go index 1da5be2..df80433 100644 --- a/util/issue_commands.go +++ b/util/issue_commands.go @@ -19,7 +19,7 @@ func buildSignBroadcastTx(goCtx context.Context, loggingContext string, sendingV GetAppLogger().Error(ctx, loggingContext+" build unsigned tx failed: "+err.Error()) return } - GetAppLogger().Info(ctx, loggingContext+" unsigned tx: "+txJSON) + GetAppLogger().Debug(ctx, loggingContext+" unsigned tx: "+txJSON) _, err = lib.BroadcastTxWithFileLock(addr, msg) if err != nil { GetAppLogger().Error(ctx, loggingContext+" broadcast tx failed: "+err.Error()) diff --git a/x/dao/keeper/reissuance.go b/x/dao/keeper/reissuance.go index e94000d..6ec57d4 100644 --- a/x/dao/keeper/reissuance.go +++ b/x/dao/keeper/reissuance.go @@ -1,6 +1,7 @@ package keeper import ( + "fmt" "math" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -140,8 +141,8 @@ func (k Keeper) ComputeReIssuanceValue(ctx sdk.Context, startHeight int64, endHe popReIssuanceString := GetReissuanceAsStringValue(obj.GetHeight()) amount, err := util.RDDLTokenStringToUint(popReIssuanceString) if err != nil { - util.GetAppLogger().Error(ctx, "unable to compute PoP re-issuance value (firstPop %u, Pops height %u, current height %u)", - startHeight, obj.GetHeight(), endHeight) + util.GetAppLogger().Error(ctx, fmt.Sprintf("unable to compute PoP re-issuance value (firstPop %d, Pop height %d, current height %d)", + startHeight, obj.GetHeight(), endHeight)) continue } if firstIncludedPop == 0 { @@ -150,8 +151,8 @@ func (k Keeper) ComputeReIssuanceValue(ctx sdk.Context, startHeight int64, endHe lastIncludedPop = obj.GetHeight() overallAmount += amount } else { - util.GetAppLogger().Debug(ctx, "the PoP is not part of the reissuance (firstPop %u, Pops height %u, current height %u)", - startHeight, obj.GetHeight(), endHeight) + util.GetAppLogger().Debug(ctx, fmt.Sprintf("the PoP is not part of the reissuance (firstPop %d, Pop height %d, current height %d)", + startHeight, obj.GetHeight(), endHeight)) if obj.GetHeight()+2*popEpochs > endHeight { break }