hyperlight-dev / hyperlight-dev/hyperlight-wasm

Should have the ability to select a world from a wit file with multiple worlds

Open
#202 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lifecycle/confirmed
Dominant language
Rust
Stars
728
Forks
39
Avg merge
2d 6h
Merged PRs (30d)
23

Description

With a simple wit file like it not possible to select a world. The last one in the file is selected and used. So in the case the bindings are generated for queue-world.

package hyperlight:worlds;

interface http-interface {
    record request {
        params: list<string>
    }

    record response {
        body: string
    }

    handle-request: func(event: request) -> response;
}

interface queue-interface {
    record message {
        data: string
    }

    record output {
        messages: list<string>
    }

    handle-message: func(msg: message) -> output;
}

world http-world {
    export http-interface;
}

world queue-world {
    export queue-interface;
}

For instance, I added queue world after getting bindings working for http-world and now get the following error. If Swap the worlds it works.

error[E0433]: failed to resolve: could not find `HttpWorldExports` in `worlds`
   --> src/main.rs:123:69
    |
123 |                     let instance = bindings::hyperlight::worlds::HttpWorldExports::http_interface(&mut wrapped);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The reproduction uses the WIT file in the issue and fails at src/main.rs:123 when generated bindings expose only the last world. Start by tracing how HttpWorldExports is generated and selected; done means http-world can be selected regardless of declaration order while queue-world remains available.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.