Skip to content

Commit

Permalink
feat: upgrade handler v0.6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Lockwarr committed Nov 11, 2024
1 parent a0c2ce7 commit 4182965
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import (
"github.com/Nolus-Protocol/nolus-core/app/keepers"
appparams "github.com/Nolus-Protocol/nolus-core/app/params"
"github.com/Nolus-Protocol/nolus-core/app/upgrades"
v066 "github.com/Nolus-Protocol/nolus-core/app/upgrades/v066"
v067 "github.com/Nolus-Protocol/nolus-core/app/upgrades/v067"
"github.com/Nolus-Protocol/nolus-core/docs"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
Expand All @@ -71,7 +71,7 @@ const (
var (
DefaultNodeHome string

Upgrades = []upgrades.Upgrade{v066.Upgrade}
Upgrades = []upgrades.Upgrade{v067.Upgrade}
)

var (
Expand Down
22 changes: 22 additions & 0 deletions app/upgrades/v067/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package v067

import (
store "cosmossdk.io/store/types"
"github.com/Nolus-Protocol/nolus-core/app/upgrades"

icqtypes "github.com/neutron-org/neutron/v4/x/interchainqueries/types"
)

const (
// UpgradeName defines the on-chain upgrades name.
UpgradeName = "v0.6.7"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{},
Deleted: []string{icqtypes.ModuleName},
},
}
33 changes: 33 additions & 0 deletions app/upgrades/v067/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package v067

import (
"context"
"fmt"

"github.com/Nolus-Protocol/nolus-core/app/keepers"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
keepers *keepers.AppKeepers,
codec codec.Codec,
) upgradetypes.UpgradeHandler {
return func(c context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx := sdk.UnwrapSDKContext(c)

ctx.Logger().Info("Starting module migrations...")
vm, err := mm.RunMigrations(ctx, configurator, vm) //nolint:contextcheck
if err != nil {
return vm, err
}

ctx.Logger().Info(fmt.Sprintf("Migration {%s} applied", UpgradeName))
return vm, nil
}
}
9 changes: 6 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/Nolus-Protocol/nolus-core

go 1.22.4
go 1.22.6

toolchain go1.22.7

require (
github.com/CosmWasm/wasmd v0.53.0
Expand All @@ -16,7 +18,7 @@ require (
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
google.golang.org/grpc v1.64.1
google.golang.org/grpc v1.65.0
gopkg.in/yaml.v2 v2.4.0
)

Expand All @@ -40,6 +42,7 @@ require (
github.com/gogo/protobuf v1.3.3
github.com/golang/mock v1.6.0
github.com/hashicorp/go-metrics v0.5.3
github.com/neutron-org/neutron/v4 v4.2.4
github.com/pkg/errors v0.9.1
google.golang.org/genproto/googleapis/api v0.0.0-20240624140628-dc46fd24d27d
google.golang.org/protobuf v1.34.2
Expand All @@ -61,7 +64,6 @@ require (
github.com/99designs/keyring v1.2.2 // indirect
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/aws/aws-sdk-go v1.44.224 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
Expand Down Expand Up @@ -180,6 +182,7 @@ require (
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/shamaton/msgpack/v2 v2.2.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/viper v1.19.0 // indirect
Expand Down
Loading

0 comments on commit 4182965

Please sign in to comment.