Skip to content

Commit 7b88fd4

Browse files
committed
Simplify NewVM
1 parent ec3a0a7 commit 7b88fd4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib_libwasmvm.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,14 @@ type VM struct {
3030
// `cacheSize` sets the size in MiB of an in-memory cache for e.g. module caching. Set to 0 to disable.
3131
// `deserCost` sets the gas cost of deserializing one byte of data.
3232
func NewVM(dataDir string, supportedCapabilities []string, memoryLimit uint32, printDebug bool, cacheSize uint32) (*VM, error) {
33-
cache, err := api.InitCache(types.VMConfig{
33+
return NewVMWithConfig(types.VMConfig{
3434
Cache: types.CacheOptions{
3535
BaseDir: dataDir,
3636
AvailableCapabilities: supportedCapabilities,
3737
MemoryCacheSize: types.NewSizeMebi(cacheSize),
3838
InstanceMemoryLimit: types.NewSizeMebi(memoryLimit),
3939
},
40-
})
41-
if err != nil {
42-
return nil, err
43-
}
44-
return &VM{cache: cache, printDebug: printDebug}, nil
40+
}, printDebug)
4541
}
4642

4743
// NewVMWithConfig creates a new VM with a custom configuration.

0 commit comments

Comments
 (0)