Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Wasm Import Sanitization #908

Merged
merged 4 commits into from
Jun 13, 2022

Conversation

dOrgJelli
Copy link
Contributor

Currently, wasm modules that expect imports that are unsupported by Polywrap will fail with an ambiguous error:

npx w3 build
Error: Invalid Wasm module found. `mutation` at <home>/integration/protocol/substrate/core-wrapper/build/mutation.wasm is invalid. Error: ,TypeError: Cannot create proxy with a non-object as target or handler
    at Compiler.<anonymous> (<home>/integration/protocol/substrate/core-wrapper/node_modules/@web3api/cli/build/lib/Compiler.js:680:31)
    at step (<home>/protocol/substrate/core-wrapper/node_modules/@web3api/cli/build/lib/Compiler.js:54:23)
    at Object.throw (<home>/integration/protocol/substrate/core-wrapper/node_modules/@web3api/cli/build/lib/Compiler.js:35:53)
    at rejected (<home>/integration/protocol/substrate/core-wrapper/node_modules/@web3api/cli/build/lib/Compiler.js:27:65)
error Command failed with exit code 1.

The error handling within this PR will now change the error code into something more actionable for the user:

Error: Unsupported wasm import namespace requested: "__wbindgen_placeholder__"; Supported wasm import namespaces: "env", "w3"

@dOrgJelli dOrgJelli requested a review from namesty as a code owner June 9, 2022 18:07
@dOrgJelli dOrgJelli merged commit f7e9757 into prealpha-dev Jun 13, 2022
@dOrgJelli dOrgJelli deleted the wasm-invalid-import-sanitization branch February 2, 2023 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant