wasm-chisel icon indicating copy to clipboard operation
wasm-chisel copied to clipboard

WASM validator module

Open axic opened this issue 6 years ago • 6 comments

This should do semantic validation of the module according to the Wasm specification.

Must also first check how much of that is done by pwasm.

axic avatar Nov 17 '18 02:11 axic

WASM specifies semantics here and pwasm does checking in places like here but not in the module itself. Is the goal of this module to have those semantic validation as shown in pwasm/examples in one place?

zixuanzh avatar Nov 17 '18 16:11 zixuanzh

This task has three parts:

  1. Reviewing/documenting the semantic validation steps needed https://webassembly.github.io/spec/core/valid/index.html
  2. Reviewing pwasm how much of that validation is implemented: https://github.com/paritytech/parity-wasm
  3. Implementing the missing steps here.

axic avatar Nov 17 '18 17:11 axic

@Steampunkery and I implemented verification for a subset of numeric instructions in our fork. parity-wasm checks types for const operators but not for binary as specified in the spec.

We simulated the stack to check for types and hence we added a new validator interface that takes in a mutable self reference. We also use a self defined enum instead of String for error handling and propagation as advised by the documentation. We will be happy to submit a PR if it will be helpful to wasm-chisel.

zixuanzh avatar Dec 06 '18 05:12 zixuanzh

Can you please open a PR? We can review it that way.

axic avatar Dec 06 '18 10:12 axic

There is no validation in parity-wasm left and everything migrated to wasmi (see this). Moreover, when we started compiling wasm into internal wasmi IR validation became mixed with compilation concerns.

There was some interest in creating a separate reusable crate from third-parties. I think parity will need this as well at some point.

pepyakin avatar Dec 18 '18 16:12 pepyakin

@pepyakin thanks for the heads up!

axic avatar Dec 18 '18 16:12 axic