Skip to main content

Module image_cap

Module image_cap 

Source
Expand description

ImageCap — Image cap.

Stores code, bitmask, jump_table, endpoints, mappings, and slot references as separate Vec<T> allocations. Allocation count per ImageCap is bounded (seven Vecs, regardless of content size); we accept that in exchange for direct field accessors.

Structs§

EndpointDef
Endpoint definition. Dense initial_regs array; index i corresponds to PVM register φ[i]. 0 is “use default” (same semantics as the spec’s old BTreeMap<u8, u64> when the key is absent).
ImageCap
ImageSlotEntry
(slot_idx, cap_hash) pair used by Image’s pinned and initial arrays. References content-addressed caps only.
MemoryMapping
One mapped region. The kernel resolves source_path at instance start, reads the bytes from the resulting Cap::Data, and lays them at [start, start + size). source_path is a fixed-cap array; source_path_len is the actual depth.

Enums§

ImageConvertError
Failure modes when converting a SCALE-encoded crate::image::Image into an ImageCap. The conversion is lossy in fields the v3 cap shape no longer carries (gas_slots, quota_slots, per-endpoint arg_registers) and constrained in others — these errors flag the constraint violations.

Functions§

image_cap
Build an ImageCap from the SCALE-encoded crate::image::Image shape. The Data content referenced by pinned and initial slots must already be published — pass the resolved (SlotIdx, CapHash) pairs in pinned_hashes and initial_hashes. The builder sorts both lists by slot index.