Skip to content

Support for verifying whether a component conforms to a world #1011

Closed

Description

@fibonacci1729

Opening this issue to track:

Context: https://bytecodealliance.zulipchat.com/#narrow/stream/327223-wit-bindgen/topic/world.20conformance/near/354678021

In the thread linked above, it was suggested that a wasm-tools component implements foo.wit foo.wasm could be useful for verifying that a component properly conforms to a world pre-instantiation.

@rylev and I were discussing this morning and will start working on this. We were thinking that we could maybe expose an implements function out of the wit-parser crate that takes 2 worlds and performs this check where the first world is the targeted world in question, and the second is the world derived from the component binary.

cc/ @alexcrichton

Activity

  1. alexcrichton commented on May 3, 2023

    @alexcrichton
    Member

    I think that an "implements" check may not be too too hard at the WIT level, but an alternative strategy I might lean towards is something along the lines of:

    • Given a WIT world, translate that to a component type. This is already done in the WIT-to-wasm translation.
    • Generate a component which embeds the component to test. Then embed a new component which imports a component of the type from the WIT-to-world translation. Then intantiate the second component with the first.

    This would rely on and leverate wasmparser's preexisting validation of components and hopefully provide somewhat reasonable error messages (but not perfect since it's wasm-vs-WIT)

    The main reason I'd lean towards this is that it gets to leverage preexisting tools and additionally doesn't have to wade into the complications that are resources with respect to type-checking.

    Does that sound reasonable from y'all's perspective?

  2. fibonacci1729 commented on May 3, 2023

    @fibonacci1729
    Author

    Ah great idea; this makes a lot of sense. Will explore this path first.

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