Skip to content

Commit

Permalink
TESTNET: add upgrade handler
Browse files Browse the repository at this point in the history
  • Loading branch information
iKapitonau committed Nov 7, 2024
1 parent 51bf4c0 commit 19cbd37
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DB_BACKEND ?= goleveldb
SGX_MODE ?= HW
BRANCH ?= develop
DEBUG ?= 0
DOCKER_TAG ?= beta
DOCKER_TAG ?= alpha

TM_SGX ?= true

Expand Down
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import (
v1_13 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.13"
v1_14 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.14"
v1_15 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.15"
v1_15_testnet_revert_proto_changes "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.15-testnet-revert-proto-changes"
v1_4 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.4"
v1_5 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.5"
v1_6 "github.com/scrtlabs/SecretNetwork/app/upgrades/v1.6"
Expand Down Expand Up @@ -125,6 +126,7 @@ var (
v1_13.Upgrade,
v1_14.Upgrade,
v1_15.Upgrade,
v1_15_testnet_revert_proto_changes.Upgrade,
}
)

Expand Down
39 changes: 39 additions & 0 deletions app/upgrades/v1.15-testnet-revert-proto-changes/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package v1_15_testnet_revert_proto_changes

import (
"context"
"fmt"
"os"

"cosmossdk.io/log"
store "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/types/module"

"github.com/scrtlabs/SecretNetwork/app/keepers"
"github.com/scrtlabs/SecretNetwork/app/upgrades"
)

const upgradeName = "v1.15-testnet-revert-proto-changes"

var Upgrade = upgrades.Upgrade{
UpgradeName: upgradeName,
CreateUpgradeHandler: createUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{},
}

func createUpgradeHandler(mm *module.Manager, appKeepers *keepers.SecretAppKeepers, configurator module.Configurator,

Check warning on line 25 in app/upgrades/v1.15-testnet-revert-proto-changes/upgrade.go

View workflow job for this annotation

GitHub Actions / lint

unused-parameter: parameter 'appKeepers' seems to be unused, consider removing or renaming it as _ (revive)
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
logger := log.NewLogger(os.Stderr)
logger.Info(` _ _ _____ _____ _____ _____ ______ `)
logger.Info(`| | | | __ \ / ____| __ \ /\ | __ \| ____|`)
logger.Info(`| | | | |__) | | __| |__) | / \ | | | | |__ `)
logger.Info(`| | | | ___/| | |_ | _ / / /\ \ | | | | __| `)
logger.Info(`| |__| | | | |__| | | \ \ / ____ \| |__| | |____ `)
logger.Info(` \____/|_| \_____|_| \_\/_/ \_\_____/|______|`)

logger.Info(fmt.Sprintf("Running module migrations for %s...", upgradeName))
return mm.RunMigrations(ctx, configurator, vm)
}
}

0 comments on commit 19cbd37

Please sign in to comment.