Expand description
The authoritative list of WASM host imports this crate declares.
§Why this exists
A Rust extern "C" declaration becomes a WASM import only if something
calls it, and it is resolved by name at module instantiation. So a crate
can declare an import no host provides, and nothing notices: the SDK
compiles, the host compiles, both publish, and CI stays green on both sides.
It surfaces only when someone writes a contract or delegate that calls the
function and watches it fail to instantiate — by which point the SDK has
been telling authors to use it, in released documentation.
That is not hypothetical. freenet-stdlib 0.10.0 shipped seven delegate host
imports that freenet-core 0.2.136 does not register: three withdrawn by
freenet-core#5638, and four that no released node ever provided. One of the
four, __frnt__delegate__subscribe_contract_checked, was documented as the
preferred alternative to a function that did work. They accumulated
because nothing compared the two sides. See freenet-stdlib#133.
§What this gives you
DECLARED_HOST_IMPORTS is a hand-maintained list, and
host_import_manifest_tests parses this crate’s own source to check that
the list and the extern "C" blocks agree. Adding or removing an import
therefore cannot be silent: it fails the build until someone edits this
list, which puts the change in the diff a reviewer reads.
§The other half lives in freenet-core
This guard proves only that the list matches what the SDK declares. It
cannot see what the host registers. freenet-core should assert its own
linker registration set against this constant — it is pub, and compiled
into the crate freenet-core already depends on, precisely so that check
needs no cross-repo file plumbing. Tracked in freenet-core#5717.
As of this release the two sets agree exactly: the 13 __frnt__delegate__*
entries below are the 13 registered by WasmtimeEngine::register_host_functions
at freenet-core 0.2.136.
Structs§
- Host
Import - One WASM host import: the import module it is resolved in, and its name.
Constants§
- DECLARED_
HOST_ IMPORTS - Every WASM host import declared by this crate, sorted by
(module, name).