Skip to content

Commit ba316e6

Browse files
committed
bump wasmvm to v2
1 parent 3422324 commit ba316e6

File tree

11 files changed

+47
-29
lines changed

11 files changed

+47
-29
lines changed

app/app.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net/http"
77
"os"
88
"path/filepath"
9+
"slices"
910

1011
"github.com/gorilla/mux"
1112
"github.com/rakyll/statik/fs"
@@ -698,7 +699,9 @@ func NewMinitiaApp(
698699
app.GRPCQueryRouter(),
699700
wasmDir,
700701
wasmConfig,
701-
"iterator,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4",
702+
slices.DeleteFunc(wasmkeeper.BuiltInCapabilities(), func(s string) bool {
703+
return s == "staking"
704+
}),
702705
authorityAddr,
703706
wasmOpts...,
704707
)

app/app_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
)
3939

4040
func TestSimAppExportAndBlockedAddrs(t *testing.T) {
41-
app := SetupWithGenesisAccounts(nil, nil)
41+
app := SetupWithGenesisAccounts(t.TempDir(), nil, nil)
4242

4343
// BlockedAddresses returns a map of addresses in app v1 and a map of modules name in app v2.
4444
for acc := range app.ModuleAccountAddrs() {
@@ -66,7 +66,7 @@ func TestInitGenesisOnMigration(t *testing.T) {
6666
db := dbm.NewMemDB()
6767
logger := log.NewLogger(os.Stdout)
6868
app := NewMinitiaApp(
69-
logger, db, nil, true, []wasmkeeper.Option{}, EmptyAppOptions{})
69+
logger, db, nil, true, []wasmkeeper.Option{}, EmptyAppOptions{homeDir: t.TempDir()})
7070
ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})
7171

7272
// Create a mock module. This module will serve as the new module we're
@@ -103,7 +103,7 @@ func TestInitGenesisOnMigration(t *testing.T) {
103103
}
104104

105105
func TestUpgradeStateOnGenesis(t *testing.T) {
106-
app := SetupWithGenesisAccounts(nil, nil)
106+
app := SetupWithGenesisAccounts(t.TempDir(), nil, nil)
107107

108108
// make sure the upgrade keeper has version map in state
109109
ctx := app.NewContext(true)
@@ -121,7 +121,7 @@ func TestGetKey(t *testing.T) {
121121
db := dbm.NewMemDB()
122122
app := NewMinitiaApp(
123123
log.NewLogger(os.Stdout),
124-
db, nil, true, []wasmkeeper.Option{}, EmptyAppOptions{})
124+
db, nil, true, []wasmkeeper.Option{}, EmptyAppOptions{homeDir: t.TempDir()})
125125

126126
require.NotEmpty(t, app.GetKey(banktypes.StoreKey))
127127
require.NotEmpty(t, app.GetMemKey(capabilitytypes.MemStoreKey))

app/encoding.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package app
22

33
import (
4+
"os"
5+
46
"cosmossdk.io/client/v2/autocli"
57
"cosmossdk.io/core/appmodule"
68
"cosmossdk.io/log"
@@ -18,7 +20,7 @@ import (
1820

1921
// MakeEncodingConfig creates an EncodingConfig for testing
2022
func MakeEncodingConfig() params.EncodingConfig {
21-
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{})
23+
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{homeDir: os.TempDir()})
2224
encodingConfig := params.EncodingConfig{
2325
InterfaceRegistry: tempApp.InterfaceRegistry(),
2426
Codec: tempApp.AppCodec(),
@@ -30,7 +32,7 @@ func MakeEncodingConfig() params.EncodingConfig {
3032
}
3133

3234
func AutoCliOpts() autocli.AppOptions {
33-
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{})
35+
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{homeDir: os.TempDir()})
3436
modules := make(map[string]appmodule.AppModule, 0)
3537
for _, m := range tempApp.ModuleManager.Modules {
3638
if moduleWithName, ok := m.(module.HasName); ok {
@@ -51,17 +53,23 @@ func AutoCliOpts() autocli.AppOptions {
5153
}
5254

5355
func BasicManager() module.BasicManager {
54-
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{})
56+
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{homeDir: os.TempDir()})
5557
return tempApp.BasicModuleManager
5658
}
5759

5860
// EmptyAppOptions is a stub implementing AppOptions
59-
type EmptyAppOptions struct{}
61+
type EmptyAppOptions struct {
62+
homeDir string
63+
}
6064

6165
// Get implements AppOptions
6266
func (ao EmptyAppOptions) Get(o string) interface{} {
6367
if o == flags.FlagHome {
64-
return DefaultNodeHome
68+
if ao.homeDir == "" {
69+
return DefaultNodeHome
70+
}
71+
72+
return ao.homeDir
6573
}
6674

6775
return nil

app/ibc-hooks/common_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package wasm_hooks_test
22

33
import (
44
"encoding/binary"
5+
"slices"
56
"testing"
67
"time"
78

@@ -294,7 +295,9 @@ func _createTestInput(
294295
nil,
295296
t.TempDir(),
296297
wasmtypes.DefaultWasmConfig(),
297-
"iterator,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4",
298+
slices.DeleteFunc(wasmkeeper.BuiltInCapabilities(), func(s string) bool {
299+
return s == "staking"
300+
}),
298301
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
299302
)
300303
wasmParams := wasmtypes.DefaultParams()

app/test_helpers.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,19 @@ func getOrCreateMemDB(db *dbm.DB) dbm.DB {
4949
if db != nil {
5050
return *db
5151
}
52+
5253
return dbm.NewMemDB()
5354
}
5455

55-
func setup(db *dbm.DB, withGenesis bool) (*MinitiaApp, GenesisState) {
56+
func setup(homeDir string, db *dbm.DB, withGenesis bool) (*MinitiaApp, GenesisState) {
5657
encCdc := MakeEncodingConfig()
5758
app := NewMinitiaApp(
5859
log.NewNopLogger(),
5960
getOrCreateMemDB(db),
6061
nil,
6162
true,
6263
[]wasmkeeper.Option{},
63-
EmptyAppOptions{},
64+
EmptyAppOptions{homeDir: homeDir},
6465
)
6566

6667
if withGenesis {
@@ -72,11 +73,12 @@ func setup(db *dbm.DB, withGenesis bool) (*MinitiaApp, GenesisState) {
7273

7374
// SetupWithGenesisAccounts setup initiaapp with genesis account
7475
func SetupWithGenesisAccounts(
76+
homeDir string,
7577
valSet *tmtypes.ValidatorSet,
7678
genAccs []authtypes.GenesisAccount,
7779
balances ...banktypes.Balance,
7880
) *MinitiaApp {
79-
app, genesisState := setup(nil, true)
81+
app, genesisState := setup(homeDir, nil, true)
8082

8183
if len(genAccs) == 0 {
8284
privAcc := secp256k1.GenPrivKey()

app/wasmtesting/common_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package wasm_hooks_test
22

33
import (
44
"encoding/binary"
5+
"slices"
56
"testing"
67
"time"
78

@@ -303,7 +304,9 @@ func _createTestInput(
303304
queryRouter,
304305
t.TempDir(),
305306
wasmtypes.DefaultWasmConfig(),
306-
"iterator,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4",
307+
slices.DeleteFunc(wasmkeeper.BuiltInCapabilities(), func(s string) bool {
308+
return s == "staking"
309+
}),
307310
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
308311
wasmOpts...,
309312
)

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ require (
1515
cosmossdk.io/store v1.1.0
1616
cosmossdk.io/tools/confix v0.1.1
1717
cosmossdk.io/x/feegrant v0.1.0
18-
cosmossdk.io/x/tx v0.13.2
18+
cosmossdk.io/x/tx v0.13.3
1919
cosmossdk.io/x/upgrade v0.1.1
2020
// we also need to update `LIBWASMVM_VERSION` of images/private/Dockerfile#5
21-
github.com/CosmWasm/wasmd v0.50.0
22-
github.com/CosmWasm/wasmvm v1.5.2
21+
github.com/CosmWasm/wasmd v0.51.0
22+
github.com/CosmWasm/wasmvm/v2 v2.0.0
2323
github.com/cometbft/cometbft v0.38.6
2424
github.com/cosmos/cosmos-db v1.0.2
2525
github.com/cosmos/cosmos-proto v1.0.0-beta.5

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk=
214214
cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU=
215215
cosmossdk.io/x/nft v0.1.0 h1:VhcsFiEK33ODN27kxKLa0r/CeFd8laBfbDBwYqCyYCM=
216216
cosmossdk.io/x/nft v0.1.0/go.mod h1:ec4j4QAO4mJZ+45jeYRnW7awLHby1JZANqe1hNZ4S3g=
217-
cosmossdk.io/x/tx v0.13.2 h1:Kh90UH30bhnnUdJH+CmWLyaH8IKdY6BBGY3EkdOk82o=
218-
cosmossdk.io/x/tx v0.13.2/go.mod h1:yhPokDCfXVIuAtyp49IFlWB5YAXUgD7Zek+ZHwsHzvU=
217+
cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g=
218+
cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys=
219219
cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc=
220220
cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0=
221221
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
@@ -227,10 +227,10 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25
227227
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
228228
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
229229
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
230-
github.com/CosmWasm/wasmd v0.50.0 h1:NVaGqCSTRfb9UTDHJwT6nQIWcb6VjlQl88iI+u1+qjE=
231-
github.com/CosmWasm/wasmd v0.50.0/go.mod h1:UjmShW4l9YxaMytwJZ7IB7MWzHiynSZP3DdWrG0FRtk=
232-
github.com/CosmWasm/wasmvm v1.5.2 h1:+pKB1Mz9GZVt1vadxB+EDdD1FOz3dMNjIKq/58/lrag=
233-
github.com/CosmWasm/wasmvm v1.5.2/go.mod h1:Q0bSEtlktzh7W2hhEaifrFp1Erx11ckQZmjq8FLCyys=
230+
github.com/CosmWasm/wasmd v0.51.0 h1:3A2o20RrdF7P1D3Xb+R7A/pHbbHWsYCDXrHLa7S0SC8=
231+
github.com/CosmWasm/wasmd v0.51.0/go.mod h1:7TSaj5HoolghujuVWeExqmcUKgpcYWEySGLSODbnnwY=
232+
github.com/CosmWasm/wasmvm/v2 v2.0.0 h1:IqNCI2G0mvs7K6ej17/I28805rVqnu+Y1cWDqIdwb08=
233+
github.com/CosmWasm/wasmvm/v2 v2.0.0/go.mod h1:su9lg5qLr7adV95eOfzjZWkGiky8WNaNIHDr7Fpu7Ck=
234234
github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4=
235235
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
236236
github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ=

x/tokenfactory/keeper/before_send.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
sdk "github.com/cosmos/cosmos-sdk/types"
1010

11-
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
11+
wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types"
1212
"github.com/initia-labs/miniwasm/x/tokenfactory/types"
1313

1414
errorsmod "cosmossdk.io/errors"

x/tokenfactory/keeper/common_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
authz "github.com/cosmos/cosmos-sdk/x/authz/module"
3636

3737
initiaappparams "github.com/initia-labs/initia/app/params"
38-
minitiaapp "github.com/initia-labs/miniwasm/app"
3938

4039
codecaddress "github.com/cosmos/cosmos-sdk/codec/address"
4140
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
@@ -324,9 +323,9 @@ func _createTestInput(
324323
nil,
325324
msgRouter,
326325
nil,
327-
minitiaapp.DefaultNodeHome,
326+
t.TempDir(),
328327
wasmtypes.DefaultWasmConfig(),
329-
"iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0",
328+
wasmkeeper.BuiltInCapabilities(),
330329
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
331330
)
332331
require.NoError(t, wasmKeeper.SetParams(ctx, wasmtypes.DefaultParams()))

x/tokenfactory/types/before_send.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package types
22

33
import (
4-
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
4+
wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types"
55
)
66

77
type BlockBeforeSendSudoMsg struct {

0 commit comments

Comments
 (0)