Skip to content

Commit 92542a0

Browse files
vexxvakandimiandre
authored andcommitted
merge wasm dir fixes from #1131
1 parent f454c17 commit 92542a0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

app/keepers/keepers.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package keepers
22

33
import (
4+
"fmt"
45
"math"
5-
"path/filepath"
6+
"path"
67

78
"github.com/CosmWasm/wasmd/x/wasm"
89
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
910
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
11+
wasmvm "github.com/CosmWasm/wasmvm/v2"
1012
"github.com/prometheus/client_golang/prometheus"
1113
"github.com/spf13/cast"
1214

@@ -218,7 +220,8 @@ func NewAppKeepers(
218220
bech32Prefix := sdk.GetConfig().GetBech32AccountAddrPrefix()
219221
ac := authcodec.NewBech32Codec(bech32Prefix)
220222
invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod))
221-
dataDir := filepath.Join(homePath, "data")
223+
dataDir := path.Join(homePath, "data")
224+
wasmDir := path.Join(dataDir, "wasm")
222225

223226
// set the BaseApp's parameter store
224227
appKeepers.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(
@@ -534,6 +537,12 @@ func NewAppKeepers(
534537
}
535538
wasmOpts = append(wasmOpts, wasmkeeper.WithGasRegister(NewJunoWasmGasRegister()))
536539

540+
wasmer, err := wasmvm.NewVM(wasmDir, wasmCapabilities, 32, wasmConfig.ContractDebugMode, wasmConfig.MemoryCacheSize)
541+
if err != nil {
542+
panic(fmt.Sprintf("failed to create juno wasmvm: %s", err))
543+
}
544+
wasmOpts = append(wasmOpts, wasmkeeper.WithWasmEngine(wasmer))
545+
537546
appKeepers.WasmKeeper = wasmkeeper.NewKeeper(
538547
appCodec,
539548
runtime.NewKVStoreService(appKeepers.keys[wasmtypes.StoreKey]),

0 commit comments

Comments
 (0)