Expand description
Guest-side SDK for Odal Node Wasm sector plugins.
A sector plugin author implements the DppSectorPlugin trait from
dpp-plugin-traits and invokes export_plugin! once. The macro generates
the full low-level Wasm ABI (alloc, dealloc, metadata, describe,
validate, calculate_metrics, generate_passport) and wires each export
to the corresponding trait method. Plugins no longer hand-roll the ABI shim
or redefine their own output structs — they speak the shared contract.
§Why describe()
The host calls describe() immediately after loading a plugin to read its
PluginCapabilities (ABI version, supported schema versions, feature
capabilities) and run dpp_plugin_traits::check_compatibility before
dispatching any work. This is what makes the version registry enforceable at
the Wasm boundary rather than aspirational.
§ABI summary
| Export | Signature | Returns (JSON) |
|---|---|---|
alloc | (len: u32) -> u32 | pointer to len bytes |
dealloc | (ptr: u32, len: u32) | — |
metadata | () -> u64 | PluginMeta |
describe | () -> u64 | PluginCapabilities |
validate | (ptr: u32, len: u32) -> u64 | AbiResult (ok: null / error) |
calculate_metrics | (ptr: u32, len: u32) -> u64 | AbiResult (ok: PluginResult) |
generate_passport | (ptr: u32, len: u32) -> u64 | AbiResult (ok: payload) |
Every -> u64 return packs the output buffer as (out_ptr << 32) | out_len.
The host reads the JSON, then frees the buffer via dealloc.
Re-exports§
pub use dpp_plugin_traits as traits;pub use dpp_rules as rules;
Modules§
Macros§
- export_
plugin - Generate the full Wasm ABI for a sector plugin.
Enums§
- Plugin
Compliance Status - Typed compliance determination returned by a plugin.
Constants§
- METRIC_
CO2E_ SCORE - Well-known metric key for CO₂e score (kg CO₂e per functional unit).
- METRIC_
RECYCLED_ CONTENT_ PCT - Well-known metric key for recycled content percentage (0.0–100.0).
- METRIC_
REPAIRABILITY_ INDEX - Well-known metric key for EN 45554 repairability index (0.0–10.0).
Functions§
- calculate_
metrics_ bytes - Run
calculate_metricsand serialise theAbiResultenvelope. - describe_
bytes - Serialise the plugin’s
PluginCapabilitiesto JSON bytes. - generate_
passport_ bytes - Run
generate_passportand serialise theAbiResultenvelope. - metadata_
bytes - Serialise the plugin’s
PluginMetato JSON bytes. - run_
calculate_ ⚠metrics - Safety
- run_
describe - run_
generate_ ⚠passport - Safety
- run_
metadata - run_
validate ⚠ - Safety
- validate_
bytes - Run
validate_inputand serialise theAbiResultenvelope.