Skip to content

Commit

Permalink
fix(upgrades): fix upgrade log (#327)
Browse files Browse the repository at this point in the history
fix logs in v0.12.1 upgrade

issue: none
  • Loading branch information
limengformal authored Oct 30, 2024
1 parent ee623dc commit 90356a4
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions client/app/upgrades/v0_12_1/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/piplabs/story/client/app/keepers"
"github.com/piplabs/story/lib/errors"
clog "github.com/piplabs/story/lib/log"
"github.com/piplabs/story/lib/log"
)

func CreateUpgradeHandler(
Expand All @@ -20,14 +20,14 @@ func CreateUpgradeHandler(
keepers *keepers.Keepers,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
clog.Info(ctx, "Starting module migrations...")
log.Info(ctx, "Starting module migrations...")

vm, err := mm.RunMigrations(ctx, configurator, vm)
if err != nil {
return vm, errors.Wrap(err, "run migrations")
}

clog.Info(ctx, "Decreasing staking periods...")
log.Info(ctx, "Decreasing staking periods...")
stakingParams, err := keepers.StakingKeeper.GetParams(ctx)
if err != nil {
return vm, errors.Wrap(err, "failed to get staking params")
Expand All @@ -36,13 +36,13 @@ func CreateUpgradeHandler(

for i := range periods {
if periods[i].PeriodType == 1 {
clog.Info(ctx, "Existing short period duration: %v hours", periods[i].Duration.Hours())
log.Info(ctx, "Existing short period duration", "Time", periods[i].Duration.String())
periods[i].Duration = time.Hour * 7 * 24 // one week in hours
} else if periods[i].PeriodType == 2 {
clog.Info(ctx, "Existing medium period duration: %v hours", periods[i].Duration.Hours())
log.Info(ctx, "Existing medium period duration", "Time", periods[i].Duration.String())
periods[i].Duration = time.Hour * 14 * 24 // two weeks in hours
} else if periods[i].PeriodType == 3 {
clog.Info(ctx, "Existing long period duration: %v hours", periods[i].Duration.Hours())
log.Info(ctx, "Existing long period duration", "Time", periods[i].Duration.String())
periods[i].Duration = time.Hour * 21 * 24 // three weeks in hours
}
}
Expand All @@ -52,7 +52,7 @@ func CreateUpgradeHandler(
return vm, errors.Wrap(err, "failed to set staking params")
}

clog.Info(ctx, "Checking newstaking periods...")
log.Info(ctx, "Checking newstaking periods...")
stakingParams, err = keepers.StakingKeeper.GetParams(ctx)
if err != nil {
return vm, errors.Wrap(err, "failed to get staking params")
Expand All @@ -61,15 +61,15 @@ func CreateUpgradeHandler(

for _, p := range periods {
if p.PeriodType == 1 {
clog.Info(ctx, "New short period duration: %v hours", p.Duration.Hours())
log.Info(ctx, "New short period duration", "Time", p.Duration.String())
} else if p.PeriodType == 2 {
clog.Info(ctx, "New medium period duration: %v hours", p.Duration.Hours())
log.Info(ctx, "New medium period duration", "Time", p.Duration.String())
} else if p.PeriodType == 3 {
clog.Info(ctx, "New long period duration: %v hours", p.Duration.Hours())
log.Info(ctx, "New long period duration", "Time", p.Duration.String())
}
}

clog.Info(ctx, "Upgrade v0.12.1 complete")
log.Info(ctx, "Upgrade v0.12.1 complete")

return vm, nil
}
Expand Down

0 comments on commit 90356a4

Please sign in to comment.