Skip to content

Commit

Permalink
Merge pull request #12 from decentrio/change-upgrade-name
Browse files Browse the repository at this point in the history
change upgrade name from v4 to v3
  • Loading branch information
GNaD13 authored May 22, 2024
2 parents a3ddce3 + 01c4d0f commit 3c26795
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
multistakingtypes "github.com/realio-tech/multi-staking-module/x/multi-staking/types"
multistaking "github.com/realiotech/realio-network/app/upgrades/multi-staking"
v4 "github.com/realiotech/realio-network/app/upgrades/v4"
v3 "github.com/realiotech/realio-network/app/upgrades/v3"
)

func (app *RealioNetwork) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
Expand All @@ -28,8 +28,8 @@ func (app *RealioNetwork) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
)

app.UpgradeKeeper.SetUpgradeHandler(
v4.UpgradeName,
v4.CreateUpgradeHandler(
v3.UpgradeName,
v3.CreateUpgradeHandler(
app.mm, app.configurator,
app.ConsensusParamsKeeper,
app.IBCKeeper.ClientKeeper,
Expand All @@ -55,7 +55,7 @@ func (app *RealioNetwork) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{multistakingtypes.ModuleName},
}
} else if upgradeInfo.Name == v4.UpgradeName {
} else if upgradeInfo.Name == v3.UpgradeName {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{crisistypes.ModuleName, consensusparamtypes.ModuleName},
}
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/v4/commission.go → app/upgrades/v3/commission.go
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v4
package v3

import (
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v4/constants.go → app/upgrades/v3/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v4
package v3

const (
// UpgradeName defines the on-chain upgrade name.
UpgradeName = "v4"
UpgradeName = "v3"
NewMinCommisionRate = "0.05"
)
2 changes: 1 addition & 1 deletion app/upgrades/v4/param_subspace.go → app/upgrades/v3/param_subspace.go
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v4
package v3

import (
"github.com/cosmos/cosmos-sdk/baseapp"
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v4/upgrades.go → app/upgrades/v3/upgrades.go
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v4
package v3

import (
"github.com/cosmos/cosmos-sdk/codec"
Expand All @@ -23,7 +23,7 @@ func CreateUpgradeHandler(
cdc codec.BinaryCodec,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("Starting upgrade for v4")
ctx.Logger().Info("Starting upgrade for v3")

fixMinCommisionRate(ctx, sk, stakingLegacySubspace)
migrateParamSubspace(ctx, ck, pk)
Expand Down
8 changes: 4 additions & 4 deletions app/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
v4 "github.com/realiotech/realio-network/app/upgrades/v4"
v3 "github.com/realiotech/realio-network/app/upgrades/v3"
"github.com/stretchr/testify/require"
)

func TestV4Upgrade(t *testing.T) {
func TestV3Upgrade(t *testing.T) {
app := Setup(false, nil, 4)
ctx := app.BaseApp.NewContext(false, tmproto.Header{Height: app.LastBlockHeight() + 1})
validators := app.StakingKeeper.GetAllValidators(ctx)
Expand Down Expand Up @@ -49,7 +49,7 @@ func TestV4Upgrade(t *testing.T) {
app.StakingKeeper.SetValidator(ctx, validators[3])

upgradePlan := upgradetypes.Plan{
Name: v4.UpgradeName,
Name: v3.UpgradeName,
Height: ctx.BlockHeight(),
}
err := app.UpgradeKeeper.ScheduleUpgrade(ctx, upgradePlan)
Expand All @@ -60,7 +60,7 @@ func TestV4Upgrade(t *testing.T) {

validatorsAfter := app.StakingKeeper.GetAllValidators(ctx)

upgradeMinCommRate := sdk.MustNewDecFromStr(v4.NewMinCommisionRate)
upgradeMinCommRate := sdk.MustNewDecFromStr(v3.NewMinCommisionRate)
require.Equal(t, validatorsAfter[0].Commission.CommissionRates.Rate, upgradeMinCommRate)
require.Equal(t, validatorsAfter[1].Commission.CommissionRates.Rate, upgradeMinCommRate)
require.Equal(t, validatorsAfter[0].Commission.CommissionRates.MaxRate, upgradeMinCommRate)
Expand Down

0 comments on commit 3c26795

Please sign in to comment.