Skip to content

Trim wasmtime serve's default world#7597

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:slim-proxy
Nov 29, 2023
Merged

Trim wasmtime serve's default world#7597
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:slim-proxy

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit aims to address a discrepancy in Wasmtime where the world supported by wasmtime serve is too large today. This includes WIT interfaces which are not specified in wasi:http/proxy such as wasi:filesystem/types, aka access to a filesystem.

This commit slims down wasmtime serve to, by default, only supporting the wasi:http/proxy world. Like with wasmtime run various CLI flags can be passed to enable more interfaces, however:

  • -Scommon - this enables "common" interfaces such as wasi:filesystem, wasi:sockets, and wasi:cli/*.
  • -Snn - this enables wasi-nn

It's expected that more will get extended here over time too.

This change is enabled by a third build of the adapter, a "proxy" mode. In this mode most functions are cfg'd to return ERRNO_NOTSUP to indicate that the runtime does not support it. Notably this includes the filesystem, arguments, and environment variables.

This change is tested by updating all api_proxy* tests to use this new adapter which is now required that many previous interfaces are no longer present by default in the proxy world.

This commit aims to address a discrepancy in Wasmtime where the world
supported by `wasmtime serve` is too large today. This includes
WIT interfaces which are not specified in `wasi:http/proxy` such as
`wasi:filesystem/types`, aka access to a filesystem.

This commit slims down `wasmtime serve` to, by default, only supporting
the `wasi:http/proxy` world. Like with `wasmtime run` various CLI flags
can be passed to enable more interfaces, however:

* `-Scommon` - this enables "common" interfaces such as
  `wasi:filesystem`, `wasi:sockets`, and `wasi:cli/*`.
* `-Snn` - this enables wasi-nn

It's expected that more will get extended here over time too.

This change is enabled by a third build of the adapter, a "proxy" mode.
In this mode most functions are cfg'd to return `ERRNO_NOTSUP` to
indicate that the runtime does not support it. Notably this includes the
filesystem, arguments, and environment variables.

This change is tested by updating all `api_proxy*` tests to use this new
adapter which is now required that many previous interfaces are no
longer present by default in the proxy world.
Copy link
Copy Markdown
Member

@elliottt elliottt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

Comment on lines -28 to -30
// TODO: this shouldn't be required, but the adapter unconditionally pulls in all of these
// dependencies.
preview2::command::add_to_linker(l)?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@alexcrichton alexcrichton added this pull request to the merge queue Nov 29, 2023
Merged via the queue into bytecodealliance:main with commit c92f009 Nov 29, 2023
@alexcrichton alexcrichton deleted the slim-proxy branch November 29, 2023 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants