Skip to main content

Crate nub

Crate nub 

Source
Expand description

Nub: the JAR v3 microkernel — uniform caller-facing handle.

The Nub handle is the API callers (chain runtime, tests, RPC, jar-apply) link against. It hides the choice of substrate behind a single invoke surface, dispatching to one of two backends:

  • Local: runs the byte-PVM interpreter directly in-process via nub_arch_local::run_instance. Used for tests, deterministic replay, and any host that doesn’t need real ring-0 isolation.
  • Hyperlight: ships the invocation as an RPC into a nub-arch-x86 guest binary running inside a Hyperlight sandbox. The actual Kernel<HyperlightArch> lives guest-side; the host holds only the sandbox + a state cache.

Both backends share the same typed publish/invoke surface — the caller publishes a Cap::Image (and optionally a Cap::CNode), publishes a Cap::Instance referencing them, and then invokes by the resulting instance hash.

Structs§

InstanceRef
Opaque, 32-byte handle to an Instance held by an Arch.
InvocationResult
Invocation result. Both backends produce this shape on completion; rkyv-archived on the wire from the cached path’s response.
InvokeOptions
Per-invocation knobs. Empty for the skeleton; fields will land as the kernel grows (gas budget overrides, quota budget, tracing, reentrancy depth limits, …).
InvokeOutcome
Result of a successful invocation. Extensible — fields land as needed (gas remaining, post-invocation cap hash, host-call trace, …). For the skeleton we expose only the JAVM HALT return value and gas used.
Nub
Uniform handle to the nub microkernel.

Type Aliases§

AbiCapHash
32-byte Cap::Instance identity hash. Matches javm_cap::CapHash byte-wise (kept as a local alias here so nub-arch-x86-abi stays free of the javm-cap dependency, which pulls in alloc::collections etc.).
CapHash
32-byte content hash. Same shape as javm_cap::CapHash; defined here locally so this crate stays no_std. A future unification pass will share the type once javm-cap becomes no_std-clean.