Skip to content

Conversation

@cpetig
Copy link
Contributor

@cpetig cpetig commented Apr 20, 2025

Implement the necessary parts of fixed size lists (see WebAssembly/component-model#384 ) to enable runtime testing in wit-bindgen.

@github-actions github-actions bot added wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:config Issues related to the configuration of Wasmtime labels Apr 20, 2025
@github-actions
Copy link

Label Messager: wasmtime:config

It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:

  • If you added a new Config method, you wrote extensive documentation for
    it.

    Details

    Our documentation should be of the following form:

    Short, simple summary sentence.
    
    More details. These details can be multiple paragraphs. There should be
    information about not just the method, but its parameters and results as
    well.
    
    Is this method fallible? If so, when can it return an error?
    
    Can this method panic? If so, when does it panic?
    
    # Example
    
    Optional example here.
    
  • If you added a new Config method, or modified an existing one, you
    ensured that this configuration is exercised by the fuzz targets.

    Details

    For example, if you expose a new strategy for allocating the next instance
    slot inside the pooling allocator, you should ensure that at least one of our
    fuzz targets exercises that new strategy.

    Often, all that is required of you is to ensure that there is a knob for this
    configuration option in wasmtime_fuzzing::Config (or one
    of its nested structs).

    Rarely, this may require authoring a new fuzz target to specifically test this
    configuration. See our docs on fuzzing for more details.

  • If you are enabling a configuration option by default, make sure that it
    has been fuzzed for at least two weeks before turning it on by default.


Details

To modify this label's message, edit the .github/label-messager/wasmtime-config.md file.

To add new label messages or remove existing label messages, edit the
.github/label-messager.json configuration file.

Learn more.

@cpetig cpetig marked this pull request as ready for review January 11, 2026 20:56
@cpetig cpetig requested a review from a team as a code owner January 11, 2026 20:56
@cpetig cpetig requested review from pchickey and removed request for a team January 11, 2026 20:56
@cpetig
Copy link
Contributor Author

cpetig commented Jan 11, 2026

The best test for this functionality are the tests added to wit-bindgen in bytecodealliance/wit-bindgen#1277 .

I can create a test for this one as well (I didn't find a good template in the existing tests), but perhaps it makes most sense to introduce tests together with the host support in #12315 .

Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

Would it be possible to add a sample *.wast test which exercises this?

@cpetig
Copy link
Contributor Author

cpetig commented Jan 12, 2026

Would it be possible to add a sample *.wast test which exercises this?

I guess it would be possible to make a two sub-component example which externally only offers a single boolean returning function, anything beyond this will depend on #12315 (e.g. passing an array to a function and checking the round-trip result).

Judging from the amount of errors uncovered by a single wit-bindgen test I think list-minmax16: func(a: list<u16, 4>, b: list<s16, 4>) -> tuple<list<u16, 4>, list<s16, 4>>; is the signature to test here 😉 (arguments are on stack, result is in memory and the tuple exercises offsets)

@alexcrichton
Copy link
Member

That sounds reasonable to me yeah, and I think it's fine to expand the test coverage over time but I also think it'd be good to test what we can in this PR itself (which is, as you say, the composed-in-the-middle use)

@cpetig cpetig requested a review from a team as a code owner January 12, 2026 19:58
@cpetig
Copy link
Contributor Author

cpetig commented Jan 12, 2026

I added a moderately readable test (created in C++, then stripped down to 400 lines of wat).

Though, I was unable to get ;;! component_model_fixed_size_lists = true recognized by the wast test runner.

Could it be that it usually sets properties according to the path of the test? Or is it supposed to work and I just missed something?

@cpetig
Copy link
Contributor Author

cpetig commented Jan 12, 2026

Oh, that is a new to me error in CI:

thread '<unnamed>' (24806) panicked at crates/environ/src/component/translate/adapt.rs:245:14:
invalid adapter module generated: multiple memories (at offset 0x5d)

I guess I need to take a deeper look tomorrow.

PS: The error on my computer is

Error: failed to run script file 'fixed_size_list.wast'

Caused by:
    0: failed directive on fixed_size_list.wast:17
    1: failed to parse WebAssembly module
    2: Fixed size lists require the component model fixed size list feature (at offset 0x16)

wasmtime wast -W component-model-fixed-size-lists fixed_size_list.wast works for me...

@alexcrichton
Copy link
Member

Oh for that you'll want to add multi_memory = true at the top of the file. Not needed on the CLI because that inherits the default feature set, but during tests we turn off all features and require them to be explicitly turned on in files

@github-actions github-actions bot added the fuzzing Issues related to our fuzzing infrastructure label Jan 12, 2026
@github-actions
Copy link

Subscribe to Label Action

cc @fitzgen

Details This issue or pull request has been labeled: "fuzzing", "wasmtime:api", "wasmtime:config"

Thus the following users have been cc'd because of the following labels:

  • fitzgen: fuzzing

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@cpetig
Copy link
Contributor Author

cpetig commented Jan 13, 2026

Oh for that you'll want to add multi_memory = true at the top of the file. Not needed on the CLI because that inherits the default feature set, but during tests we turn off all features and require them to be explicitly turned on in files

My assumption was that this is caused by the component to component copying code https://github.com/bytecodealliance/wasmtime/pull/10619/files#diff-32f96d31ce61f8177ede00faf17bc565a8d15a00d42eb20b28a948a7a257dd87R2885-R2953 - I would assume that all adapters need multi-memory to work.

@cpetig
Copy link
Contributor Author

cpetig commented Jan 13, 2026

My assumption was that this is caused by the component to component copying code https://github.com/bytecodealliance/wasmtime/pull/10619/files#diff-32f96d31ce61f8177ede00faf17bc565a8d15a00d42eb20b28a948a7a257dd87R2885-R2953 - I would assume that all adapters need multi-memory to work.

I was looking for wasmtime wast to pick up the setting and didn't realize that the test runner takes care of this. Should work now. Thank you for the tip, Alex.

…ngth lists"

changing wasm-tools (parser etc. is a different task)
@cpetig
Copy link
Contributor Author

cpetig commented Jan 13, 2026

😊 Oh, I took a look whether "fixed-size-list" or "fixed-size-lists" is the name in the component spec, it is "fixed-length lists". So, I made sure that wasmtime adheres to the standard name.

Whether/how to change wasm-tools will be a separate discussion.

@cpetig cpetig changed the title Minimal implementation of fixed size lists to enable wit-bindgen runtime tests Minimal implementation of fixed-length lists to enable wit-bindgen runtime tests Jan 13, 2026
@alexcrichton alexcrichton added this pull request to the merge queue Jan 14, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 14, 2026
@alexcrichton alexcrichton added this pull request to the merge queue Jan 14, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 14, 2026
@alexcrichton alexcrichton added this pull request to the merge queue Jan 14, 2026
Merged via the queue into bytecodealliance:main with commit caf0f75 Jan 14, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fuzzing Issues related to our fuzzing infrastructure wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:config Issues related to the configuration of Wasmtime

Development

Successfully merging this pull request may close these issues.

2 participants