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 PVM2 (RISC-V) 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-x86guest binary running inside a Hyperlight sandbox. The actualKernel<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§
- Instance
Ref - Opaque, 32-byte handle to an Instance held by an
Arch. - Invocation
Result - Invocation result. Both backends produce this shape on completion; rkyv-archived on the wire from the cached path’s response.
- Invoke
Job - Invoke
JobId - Invoke
Options - Per-invocation knobs. Empty for the skeleton; fields will land as the kernel grows (gas budget overrides, quota budget, tracing, reentrancy depth limits, …).
- Invoke
Outcome - 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.
- Invoke
Request - Nub
- Uniform handle to the nub microkernel.
- NubOptions
- Options used when constructing the process-wide Hyperlight Nub singleton.
Constants§
- MAX_
HYPERLIGHT_ VCPUS - SCRATCHPAD_
HEAD_ LEN - Bytes of the running Instance’s scratchpad (
slot[0]) region surfaced at the top-level HALT — a fixed-size head of the returned DataCap’s effective content. The guest writes its result into the scratchpad-mapped memory region during the run (CoW into the cap); at top HALT the engine reads the region’s effective bytes back out here, so the host observes the full, uncompressed result without a separate data-flow event.
Type Aliases§
- AbiCap
Hash - 32-byte Cap::Instance identity hash. Matches
javm_cap::CapHashbyte-wise (kept as a local alias here sonub-arch-x86-abistays free of the javm-cap dependency, which pulls inalloc::collectionsetc.). - CapHash
- 32-byte content hash. Same shape as
javm_cap::CapHash; defined here locally so this crate staysno_std. A future unification pass will share the type oncejavm-capbecomesno_std-clean. - Hyperlight
NubGuard - Compatibility alias for older tests/benches that named the returned
Hyperlight singleton borrow.
Nubis now a cloneable handle; synchronization lives inside the handle instead of in an outer mutex guard.