Skip to content

Commit

Permalink
delete existing upgrade handler
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-cha committed Oct 29, 2024
1 parent b64b12d commit 8cf39c3
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions app/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package app
import (
"bytes"
"context"
"encoding/base64"
"errors"

sdkerrors "cosmossdk.io/errors"
Expand All @@ -15,43 +14,12 @@ import (
vmtypes "github.com/initia-labs/movevm/types"
)

const upgradeName056 = "0.5.6"
const upgradeName060 = "0.6.0"
const upgradeName = "0.6.0"

// RegisterUpgradeHandlers returns upgrade handlers
func (app *InitiaApp) RegisterUpgradeHandlers(cfg module.Configurator) {
app.UpgradeKeeper.SetUpgradeHandler(
upgradeName056,
func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
// diff: https://github.com/initia-labs/movevm/compare/v0.4.12...v0.5.0
codes := []string{
// cosmos.move
"oRzrCwYAAAALAQAQAhAaAyqXAQTBAQIFwwGQBAfTBZ4FCPEKIAaRCxoQqwt0Cp8MGgy5DPUJAAAACAAPABEAEgAZACgAMAABAwAABQMAAQcHAAIOBwEAAQMQCwAGJwgAAA0AAQAEEwIDAAEUBAUAABUGAQAAFgcBAAAXCAEAAAIBCgAAGAwKAAUaDQ0AARsEDgAAHAEKAAAdDAoAAB4QAQAAHxEBAAAgEgEAACEVAQAAIhcBAAAjGQEAACQaAQAAJRwBAAAmHgEAACkfAQAAKiEBAAArIgEAACwkAQAALSUBAAAuJwEAAS8TFAAHMSkTAQIAMisBABwoBAYMCAILAwEIBAMAAQYMAQUBBggCAQYKAgQFCgIGCwMBCAQDCgYMCAILAwEIBAMIAggCAwMDCAIKBQoCBgsDAQgEAwoCCgIDAwMKAgYKAgoCCgIGCwMBCAQKAgUBCAABAgIDCAIBAwEBAwMKAgEDBgwLAwEIBAMDBQYLAwEIBAMGBgwFCAIIAgoIAgoKAgEKAgEI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AAnCwMrBBAFCwEIES8CMAEAACsKCwALAQsCCwMLBAsFCwYRMQECMQEAADcyDgMRIxQMBwsACwcRMgwIDggMCQoJCwELAgsDCwQLBQsGETMKCRE0CgkRNQoJETYKCRE3DAoOCgwAEgQMDgsACw4tBAoJETgSAjgMCgk4DQwPCg8SBQoPEgALDxIDCwkROwI8AQAABAMLACkEAj0BAAAEBQsACwERBSkEAj4BAAA7Ng4AOAYMAQoAEQcLAAcAOA4MAwwECwMEFgoEDAUHAhFADAYLBQsGIQwDBRgJDAMLAwQeBwMRQAwEBR4HAAoEEQUKASEEJgsEAgcBEUAMBw4BOA8MCA4IEUINBwwJDAQLCQsEEUMLBwJEAQABBCcUCwAQBBQMAg4COAYMAwoDKQQECwUNBgIAAAAAAAAAJwsDKwQQBQsBCREvAgAABAEFAAQAAwAEAgBWAFcA",
}

modules := make([]vmtypes.Module, len(codes))
for i, code := range codes {
codeBz, err := base64.StdEncoding.DecodeString(code)
if err != nil {
return nil, sdkerrors.Wrap(err, "failed to decode module code")
}

modules[i] = vmtypes.NewModule(codeBz)
}

err := app.MoveKeeper.PublishModuleBundle(ctx, vmtypes.StdAddress, vmtypes.NewModuleBundle(modules...), movetypes.UpgradePolicy_COMPATIBLE)
if err != nil {
return nil, sdkerrors.Wrap(err, "failed to publish module bundle")
}

return vm, nil
},
)

app.UpgradeKeeper.SetUpgradeHandler(
upgradeName060,
upgradeName,
func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {

// 1. publish new code module first
Expand Down

0 comments on commit 8cf39c3

Please sign in to comment.