Skip to content

Post compilation error when adding additional substrate crate #71

Description

@ivanceras

Using sp-core works without problem, but then adding the additional substrate crate: sp-runtime, sp-version, sp-std, sp-keyring will make a compilation issue.

our fork in branch substrate-integration.

$ yarn rebuild
yarn run v1.22.10
warning package.json: No license field
$ yarn clean && yarn codegen && yarn build
warning package.json: No license field
$ rm -rf module/src/w3 && rm -rf test/w3
warning package.json: No license field
$ npx w3 codegen
✔ Manifest loaded from ./web3api.yaml
✔ Codegen Web3API schema bindings
🔥 Types were generated successfully 🔥
warning package.json: No license field
$ npx w3 build
Error: Invalid Wasm module found. `mutation` at <home>/integrations-chainsafe/protocol/substrate/core-wrapper/build/mutation.wasm is invalid. Error: ,Error: Unsupported wasm import namespace requested: "__wbindgen_placeholder__"; Supported wasm import namespaces: "env", "w3"
    at Compiler.<anonymous> (<home>/integrations-chainsafe/protocol/substrate/core-wrapper/node_modules/@web3api/cli/build/lib/Compiler.js:680:31)
    at step (<home>/integrations-chainsafe/protocol/substrate/core-wrapper/node_modules/@web3api/cli/build/lib/Compiler.js:54:23)
    at Object.throw (<home>/integrations-chainsafe/protocol/substrate/core-wrapper/node_modules/@web3api/cli/build/lib/Compiler.js:35:53)
    at rejected (<home>/integrations-chainsafe/protocol/substrate/core-wrapper/node_modules/@web3api/cli/build/lib/Compiler.js:27:65)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Primary investigation suggest that this is cause by usage of wasm-bindgem which is coming from getrandom crate.

Take note that the getrandom crate was included beforehand in the crates' Cargo.toml together with sp-core and it works without problems. It's when the other 4 crates: sp-runtime, sp-version, sp-std, sp-keyring where it makes the compilation issue occur.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions