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 <jmastr@mailbox.org>
This commit is contained in:
Julian Strobl 2023-12-19 14:28:15 +01:00
parent 4f91e0925c
commit defc6a3e4d
No known key found for this signature in database
GPG Key ID: E0A8F9AD733499A7
5 changed files with 16 additions and 15 deletions

View File

@ -22,10 +22,10 @@ func (cmad CheckReissuanceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu
if sdk.MsgTypeURL(msg) == "/planetmintgo.dao.MsgReissueRDDLProposal" { if sdk.MsgTypeURL(msg) == "/planetmintgo.dao.MsgReissueRDDLProposal" {
MsgProposal, ok := msg.(*daotypes.MsgReissueRDDLProposal) MsgProposal, ok := msg.(*daotypes.MsgReissueRDDLProposal)
if ok { 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) isValid := cmad.dk.IsValidReIssuanceProposal(ctx, MsgProposal)
if !isValid { 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") return ctx, errorsmod.Wrapf(daotypes.ErrReissuanceProposal, "error during CheckTx or ReCheckTx")
} }
util.GetAppLogger().Debug(ctx, "ante handler - accepted re-issuance proposal") util.GetAppLogger().Debug(ctx, "ante handler - accepted re-issuance proposal")

View File

@ -359,7 +359,7 @@ func initAppConfig(clientCtx client.Context) (string, interface{}) {
type CustomAppConfig struct { type CustomAppConfig struct {
serverconfig.Config serverconfig.Config
PlmntConfig planetmintconfig.Config PlmntConfig planetmintconfig.Config
RPCConfig lib.Config LibConfig lib.Config
} }
// Optionally allow the chain developer to overwrite the SDK's default // 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. // In simapp, we set the min gas prices to 0.
srvCfg.MinGasPrices = "0stake" srvCfg.MinGasPrices = "0stake"
plmntCfg := planetmintconfig.GetConfig() plmntConfig := planetmintconfig.GetConfig()
plmntCfg.SetRoot(clientCtx.HomeDir) plmntConfig.SetRoot(clientCtx.HomeDir)
rpcCfg := lib.GetConfig() libConfig := lib.GetConfig()
rpcCfg.SetChainID(clientCtx.ChainID) libConfig.SetChainID(clientCtx.ChainID)
customAppConfig := CustomAppConfig{ customAppConfig := CustomAppConfig{
Config: *srvCfg, Config: *srvCfg,
PlmntConfig: *plmntCfg, PlmntConfig: *plmntConfig,
RPCConfig: *rpcCfg, LibConfig: *libConfig,
} }
customAppTemplate := serverconfig.DefaultConfigTemplate + planetmintconfig.DefaultConfigTemplate customAppTemplate := serverconfig.DefaultConfigTemplate + planetmintconfig.DefaultConfigTemplate

View File

@ -94,7 +94,7 @@ func DefaultConfig() *Config {
DistributionAddrInv: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG", DistributionAddrInv: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
DistributionAddrDAO: "vjU8eMzU3JbUWZEpVANt2ePJuPWSPixgjiSj2jDMvkVVQQi2DDnZuBRVX4Ygt5YGBf5zvTWCr1ntdqYH", DistributionAddrDAO: "vjU8eMzU3JbUWZEpVANt2ePJuPWSPixgjiSj2jDMvkVVQQi2DDnZuBRVX4Ygt5YGBf5zvTWCr1ntdqYH",
DistributionAddrPop: "vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD", 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) ReIssuanceEpochs: 17280, // CometBFT epochs of 5s equate 1 day (12*60*24)
} }
} }

View File

@ -19,7 +19,7 @@ func buildSignBroadcastTx(goCtx context.Context, loggingContext string, sendingV
GetAppLogger().Error(ctx, loggingContext+" build unsigned tx failed: "+err.Error()) GetAppLogger().Error(ctx, loggingContext+" build unsigned tx failed: "+err.Error())
return return
} }
GetAppLogger().Info(ctx, loggingContext+" unsigned tx: "+txJSON) GetAppLogger().Debug(ctx, loggingContext+" unsigned tx: "+txJSON)
_, err = lib.BroadcastTxWithFileLock(addr, msg) _, err = lib.BroadcastTxWithFileLock(addr, msg)
if err != nil { if err != nil {
GetAppLogger().Error(ctx, loggingContext+" broadcast tx failed: "+err.Error()) GetAppLogger().Error(ctx, loggingContext+" broadcast tx failed: "+err.Error())

View File

@ -1,6 +1,7 @@
package keeper package keeper
import ( import (
"fmt"
"math" "math"
"github.com/cosmos/cosmos-sdk/store/prefix" "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()) popReIssuanceString := GetReissuanceAsStringValue(obj.GetHeight())
amount, err := util.RDDLTokenStringToUint(popReIssuanceString) amount, err := util.RDDLTokenStringToUint(popReIssuanceString)
if err != nil { if err != nil {
util.GetAppLogger().Error(ctx, "unable to compute PoP re-issuance value (firstPop %u, Pops height %u, current height %u)", 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) startHeight, obj.GetHeight(), endHeight))
continue continue
} }
if firstIncludedPop == 0 { if firstIncludedPop == 0 {
@ -150,8 +151,8 @@ func (k Keeper) ComputeReIssuanceValue(ctx sdk.Context, startHeight int64, endHe
lastIncludedPop = obj.GetHeight() lastIncludedPop = obj.GetHeight()
overallAmount += amount overallAmount += amount
} else { } else {
util.GetAppLogger().Debug(ctx, "the PoP is not part of the reissuance (firstPop %u, Pops height %u, current height %u)", 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) startHeight, obj.GetHeight(), endHeight))
if obj.GetHeight()+2*popEpochs > endHeight { if obj.GetHeight()+2*popEpochs > endHeight {
break break
} }