Skip to content

wac plug error: "error: encoding produced a component that failed validation" #141

Description

@estk

Repro

https://github.com/estk/hotswap-example

The error

wac plug --plug types.wasm salutation.wasm -o tysal.wasm
error: encoding produced a component that failed validation

Caused by:
    instance not valid to be used as export (at offset 0x36d3bf)

Why this is surprising to me

Since the user-interface interface is local to the hotswap::salutation package and the plugged world types exports the user-interface interface, I would have thought that the imports were satisfied and that the underlying types in user-interface would be automatically re-exported.

WIT at a glance

In the salutation package we have the following:

package hotswap:salutation@0.1.0;

interface salutation {
    use user-interface.{user};

    variant formal-honorific {
        sir,
        maam,
        sir-maam,
        custom(string)
    } 
    get-formal-honorific: func(u: user) -> formal-honorific;
    greet: func(u: user) -> string;
}

world app {
    import user-interface;
    export salutation;
}

...

interface salutation {
    use user-interface.{user};

    variant formal-honorific {
        sir,
        maam,
        sir-maam,
        custom(string)
    } 
    get-formal-honorific: func(u: user) -> formal-honorific;
    greet: func(u: user) -> string;
}

world app {
    import user-interface;
    export salutation;
}

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