Stream: git-wasmtime

Topic: wasmtime / issue #10437 Define default-value constructors...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 20 2025 at 19:29):

fitzgen added the good first issue label to Issue #10437.

view this post on Zulip Wasmtime GitHub notifications bot (Mar 20 2025 at 19:29):

fitzgen opened issue #10437:

We already have code to create default values in order to implement https://docs.rs/wasmtime/latest/wasmtime/struct.Linker.html#method.define_unknown_imports_as_default_values

We have duplicates of that code in the fuzzing utility crate: https://github.com/bytecodealliance/wasmtime/blob/main/crates/fuzzing/src/oracles/dummy.rs

We should just expose those constructors in the public API of the wasmtime crate, move the various fuzzing oracles over to these methods, and then delete 95% of that wasmtime_fuzzing::oracles::dummy module.

I am thinking that we will want to expose these as pub fn default_value(&self, store: impl AsContextMut) -> Option<T> methods on wasmtime::{ExternType,GlobalType,MemoryType,ValType,...} where T is wasmtime::Memory for the wasmtime::MemoryType method, etc...

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2025 at 22:18):

shashi1687 commented on issue #10437:

Hi @maintainers :wave:

I’d love to tackle #10437 “Define default-value constructors for various Wasm types in the host API.” I’ve already cloned Wasmtime, run the existing wasmtime-fuzzing tests, and traced how dummy-linker uses import.ty().default_value(&mut *store) to synthesize imports. My plan is to:

  1. Expose ExternType::default_value in the public API by matching on each variant (func, global, memory, table) and returning a default Extern.
  2. Add per-type helpers (e.g. GlobalType::default_value) so users don’t need to manually wrap in ExternType.
  3. Write unit tests in crates/api/tests/default_value.rs for each type to ensure correct defaults.
  4. Validate via cargo test, cargo fmt, and cargo clippy --workspace --all-targets.

I’m comfortable working in the wasmtime crate’s Rust API modules and following the existing style guidelines. Could you please assign this issue to me?
Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2025 at 23:37):

shashi1687 edited a comment on issue #10437:

Hi all,

I’ve traced through crates/wasmtime/src/runtime/types.rs and can confirm that all five default_value constructors are already exposed in the public API:

That means #10437 is already implemented upstream. My original plan was to:

  1. Expose these helpers in the public API.
  2. Add unit tests in crates/api/tests/default_value.rs.
  3. Validate via cargo test, cargo fmt, and cargo clippy.

Since the code is already present, here are the proposed next steps:

  1. Test coverage: Add any missing corner-case tests (e.g. tags or other edge types).
  2. Documentation/examples: Draft a short example in examples/default_value.rs or update the guide to illustrate these APIs.
  3. Close/Follow-up: If there’s nothing more to add here, please let me know and we can close this issue.

Happy to take on any of the above—just let me know what you’d like!

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2025 at 23:37):

shashi1687 edited a comment on issue #10437:

Hi all,

I’ve traced through crates/wasmtime/src/runtime/types.rs and can confirm that all five default_value constructors are already exposed in the public API:

That means #10437 is already implemented upstream. My original plan was to:

  1. Expose these helpers in the public API.
  2. Add unit tests in crates/api/tests/default_value.rs.
  3. Validate via cargo test, cargo fmt, and cargo clippy.

Since the code is already present, here are the proposed next steps:

  1. Test coverage: Add any missing corner-case tests (e.g. tags or other edge types).
  2. Documentation/examples: Draft a short example in examples/default_value.rs or update the guide to illustrate these APIs.
  3. Close/Follow-up: If there’s nothing more to add here, please let me know .

Happy to take on any of the above—just let me know what you’d like!

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2025 at 23:41):

shashi1687 edited a comment on issue #10437:

Hi all,

I’ve traced through crates/wasmtime/src/runtime/types.rs and can confirm that all five default_value constructors are already exposed in the public API:

This is my first issue in Wasmtime, and I’d love your suggestions and input on what to do next in this PR:

Looking forward to your guidance—thanks for your help!

view this post on Zulip Wasmtime GitHub notifications bot (Jul 07 2025 at 16:11):

fitzgen commented on issue #10437:

Hi @shashi1687,

It looks like {Global,Table,Memory}Type::default_value do not have any any doc comments. Adding a couple sentences to those docs would be fantastic. Once that is done, I think we can close this issue.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 08 2025 at 00:19):

shashi1687 commented on issue #10437:

Hi @fitzgen , thanks for the feedback! I’ve added doc comments to:

Could you please take another look and let me know if there’s anything else to improve? Thanks! :blush:

view this post on Zulip Wasmtime GitHub notifications bot (Jul 08 2025 at 00:34):

shashi1687 deleted a comment on issue #10437:

Hi @fitzgen , thanks for the feedback! I’ve added doc comments to:

Could you please take another look and let me know if there’s anything else to improve? Thanks! :blush:

view this post on Zulip Wasmtime GitHub notifications bot (Jul 08 2025 at 00:34):

shashi1687 commented on issue #10437:

Hi @fitzgen , thanks for the feedback! I’ve added doc comments to:

Could you please take another look and let me know if there’s anything else to improve? Thanks! :blush:

view this post on Zulip Wasmtime GitHub notifications bot (Jul 08 2025 at 01:09):

pchickey closed issue #10437:

We already have code to create default values in order to implement https://docs.rs/wasmtime/latest/wasmtime/struct.Linker.html#method.define_unknown_imports_as_default_values

We have duplicates of that code in the fuzzing utility crate: https://github.com/bytecodealliance/wasmtime/blob/main/crates/fuzzing/src/oracles/dummy.rs

We should just expose those constructors in the public API of the wasmtime crate, move the various fuzzing oracles over to these methods, and then delete 95% of that wasmtime_fuzzing::oracles::dummy module.

I am thinking that we will want to expose these as pub fn default_value(&self, store: impl AsContextMut) -> Option<T> methods on wasmtime::{ExternType,GlobalType,MemoryType,ValType,...} where T is wasmtime::Memory for the wasmtime::MemoryType method, etc...


Last updated: Dec 13 2025 at 21:03 UTC