|
1 | 1 | package keepers |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "fmt" |
4 | 5 | "math" |
5 | | - "path/filepath" |
| 6 | + "path" |
6 | 7 |
|
7 | 8 | "github.com/CosmWasm/wasmd/x/wasm" |
8 | 9 | wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" |
9 | 10 | wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" |
| 11 | + wasmvm "github.com/CosmWasm/wasmvm/v2" |
10 | 12 | "github.com/prometheus/client_golang/prometheus" |
11 | 13 | "github.com/spf13/cast" |
12 | 14 |
|
@@ -218,7 +220,8 @@ func NewAppKeepers( |
218 | 220 | bech32Prefix := sdk.GetConfig().GetBech32AccountAddrPrefix() |
219 | 221 | ac := authcodec.NewBech32Codec(bech32Prefix) |
220 | 222 | 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") |
222 | 225 |
|
223 | 226 | // set the BaseApp's parameter store |
224 | 227 | appKeepers.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( |
@@ -534,6 +537,12 @@ func NewAppKeepers( |
534 | 537 | } |
535 | 538 | wasmOpts = append(wasmOpts, wasmkeeper.WithGasRegister(NewJunoWasmGasRegister())) |
536 | 539 |
|
| 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 | + |
537 | 546 | appKeepers.WasmKeeper = wasmkeeper.NewKeeper( |
538 | 547 | appCodec, |
539 | 548 | runtime.NewKVStoreService(appKeepers.keys[wasmtypes.StoreKey]), |
|
0 commit comments