Skip to content

Commit

Permalink
fix: enable some features of the wasm runtime (aquasecurity#2575)
Browse files Browse the repository at this point in the history
  • Loading branch information
otms61 authored Jul 24, 2022
1 parent 8467790 commit 7b4f2dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
pull_request:
env:
GO_VERSION: "1.18"
TINYGO_VERSION: "0.23.0"
TINYGO_VERSION: "0.24.0"
jobs:
test:
name: Test
Expand Down
9 changes: 8 additions & 1 deletion pkg/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,15 @@ type Manager struct {
func NewManager(ctx context.Context) (*Manager, error) {
m := &Manager{}

// The runtime must enable the following features because Tinygo uses these features to build.
// cf. https://github.com/tinygo-org/tinygo/blob/b65447c7d567eea495805656f45472cc3c483e03/targets/wasi.json#L4
c := wazero.NewRuntimeConfig().
WithFeatureBulkMemoryOperations(true).
WithFeatureNonTrappingFloatToIntConversion(true).
WithFeatureSignExtensionOps(true)

// Create a new WebAssembly Runtime.
m.runtime = wazero.NewRuntime()
m.runtime = wazero.NewRuntimeWithConfig(c)

// Load WASM modules in local
if err := m.loadModules(ctx); err != nil {
Expand Down

0 comments on commit 7b4f2dc

Please sign in to comment.