Skip to content

Commit a58daf9

Browse files
authored
prepare v0.6.2 release (#307)
1 parent 8a3d125 commit a58daf9

File tree

3 files changed

+7
-88
lines changed

3 files changed

+7
-88
lines changed

app/upgrade.go

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,19 @@
11
package app
22

33
import (
4-
"bytes"
54
"context"
6-
"errors"
7-
"fmt"
85

9-
"cosmossdk.io/collections"
10-
sdkerrors "cosmossdk.io/errors"
116
upgradetypes "cosmossdk.io/x/upgrade/types"
127
"github.com/cosmos/cosmos-sdk/types/module"
13-
14-
movetypes "github.com/initia-labs/initia/x/move/types"
15-
vmprecompile "github.com/initia-labs/movevm/precompile"
16-
vmtypes "github.com/initia-labs/movevm/types"
178
)
189

19-
const upgradeName = "0.6.0"
10+
const upgradeName = "0.6.2"
2011

2112
// RegisterUpgradeHandlers returns upgrade handlers
2213
func (app *InitiaApp) RegisterUpgradeHandlers(cfg module.Configurator) {
2314
app.UpgradeKeeper.SetUpgradeHandler(
2415
upgradeName,
2516
func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
26-
27-
// 1. publish new code module first
28-
codeModuleBz, err := vmprecompile.ReadStdlib("code.mv")
29-
if err != nil {
30-
return nil, err
31-
}
32-
err = app.MoveKeeper.SetModule(ctx, vmtypes.StdAddress, movetypes.MoveModuleNameCode, codeModuleBz[0])
33-
if err != nil {
34-
return nil, err
35-
}
36-
37-
// 2. update vm data with new separator and add checksums of each module
38-
39-
// Previous:
40-
// ModuleSeparator = byte(0)
41-
// ResourceSeparator = byte(1)
42-
// TableEntrySeparator = byte(2)
43-
// TableInfoSeparator = byte(3)
44-
45-
// Current:
46-
// ModuleSeparator = byte(0)
47-
// ChecksumSeparator = byte(1)
48-
// ResourceSeparator = byte(2)
49-
// TableEntrySeparator = byte(3)
50-
// TableInfoSeparator = byte(4)
51-
52-
err = app.MoveKeeper.VMStore.Walk(ctx, new(collections.Range[[]byte]).Descending(), func(key, value []byte) (stop bool, err error) {
53-
key = bytes.Clone(key)
54-
55-
cursor := movetypes.AddressBytesLength
56-
if len(key) <= cursor {
57-
return true, fmt.Errorf("invalid key length: %d", len(key))
58-
}
59-
60-
separator := key[cursor]
61-
if separator == movetypes.ModuleSeparator {
62-
checksum := movetypes.ModuleBzToChecksum(value)
63-
value = checksum[:]
64-
} else if separator >= movetypes.TableInfoSeparator {
65-
return true, errors.New("unknown prefix")
66-
} else if err = app.MoveKeeper.VMStore.Remove(ctx, key); err != nil {
67-
return true, err
68-
}
69-
70-
key[cursor] = key[cursor] + 1
71-
err = app.MoveKeeper.VMStore.Set(ctx, key, value)
72-
if err != nil {
73-
return true, err
74-
}
75-
76-
return false, nil
77-
})
78-
if err != nil {
79-
return nil, err
80-
}
81-
82-
// 3. update new modules
83-
84-
codesBz, err := vmprecompile.ReadStdlib("object_code_deployment.mv", "coin.mv", "cosmos.mv", "dex.mv", "json.mv", "bech32.mv", "hash.mv", "collection.mv")
85-
if err != nil {
86-
return nil, err
87-
}
88-
modules := make([]vmtypes.Module, len(codesBz))
89-
for i, codeBz := range codesBz {
90-
modules[i] = vmtypes.NewModule(codeBz)
91-
}
92-
93-
err = app.MoveKeeper.PublishModuleBundle(ctx, vmtypes.StdAddress, vmtypes.NewModuleBundle(modules...), movetypes.UpgradePolicy_COMPATIBLE)
94-
if err != nil {
95-
return nil, sdkerrors.Wrap(err, "failed to publish module bundle")
96-
}
97-
9817
return vm, nil
9918
},
10019
)

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ require (
4040
github.com/gorilla/mux v1.8.1
4141
github.com/grpc-ecosystem/grpc-gateway v1.16.0
4242
github.com/hashicorp/go-metrics v0.5.3
43-
github.com/initia-labs/OPinit v0.5.6
43+
github.com/initia-labs/OPinit v0.6.0
4444
// we also need to update `LIBMOVEVM_VERSION` of Dockerfile#9
4545
github.com/initia-labs/movevm v0.6.1
4646
github.com/noble-assets/forwarding/v2 v2.0.0-20240521090705-86712c4c9e43
@@ -151,7 +151,7 @@ require (
151151
github.com/iancoleman/strcase v0.3.0 // indirect
152152
github.com/improbable-eng/grpc-web v0.15.0 // indirect
153153
github.com/inconshreveable/mousetrap v1.1.0 // indirect
154-
github.com/initia-labs/OPinit/api v0.5.1 // indirect
154+
github.com/initia-labs/OPinit/api v0.6.0 // indirect
155155
github.com/jmespath/go-jmespath v0.4.0 // indirect
156156
github.com/jmhodges/levigo v1.0.0 // indirect
157157
github.com/klauspost/compress v1.17.9 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,10 +724,10 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
724724
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
725725
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
726726
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
727-
github.com/initia-labs/OPinit v0.5.6 h1:m+RHWD64rWcvEfe4ZEi9IHxBrMmKUq4VQA7KTZpMMSk=
728-
github.com/initia-labs/OPinit v0.5.6/go.mod h1:lx1amLMszculwPu8ln+btJno38UV28fd2nP7XC88ZeE=
729-
github.com/initia-labs/OPinit/api v0.5.1 h1:zwyJf7HtKJCKvLJ1R9PjVfJO1L+d/jKoeFyT7WTLHFI=
730-
github.com/initia-labs/OPinit/api v0.5.1/go.mod h1:gHK6DEWb3/DqQD5LjKirUx9jilAh2UioXanoQdgqVfU=
727+
github.com/initia-labs/OPinit v0.6.0 h1:V9jQf8+PjNctLX31FHMGUsk6fpnygVJO1WYzCmBMzkU=
728+
github.com/initia-labs/OPinit v0.6.0/go.mod h1:gDpCh4Zx94mihwgzP/PLav8eVHLroZBu3dFyzCy8iIs=
729+
github.com/initia-labs/OPinit/api v0.6.0 h1:Q3hDHpTd9EqlDfY/OryCKIwuXYWJxGJdGfJicV1RjL4=
730+
github.com/initia-labs/OPinit/api v0.6.0/go.mod h1:gHK6DEWb3/DqQD5LjKirUx9jilAh2UioXanoQdgqVfU=
731731
github.com/initia-labs/cometbft v0.0.0-20241106155049-4698d4a37fe1 h1:Hqxf4a6PfCatz5vCBCovjhn4FwYaooCXIvyv4MM4Wjs=
732732
github.com/initia-labs/cometbft v0.0.0-20241106155049-4698d4a37fe1/go.mod h1:+wh6ap6xctVG+JOHwbl8pPKZ0GeqdPYqISu7F4b43cQ=
733733
github.com/initia-labs/movevm v0.6.1 h1:g+nUX289tou8HaHkwvZIE7KzhVAi+fykpGORItw8j0E=

0 commit comments

Comments
 (0)