Skip to content

Allow precise host-function requirements for snapshot/restore #338

Description

@simongdavies

Problem

Hyperlight-JS snapshots distinguish:

  • available: callbacks installed in the destination host
  • required: callbacks exposed to the current guest state and recorded in snapshots

Consider:

  1. Snapshot requires function A.
  2. Destination provides A and B.
  3. Restore preserves required = {A} and available = {A, B}.
  4. A new handler that calls B is staged.
  5. The next snapshot must require both A and B.

Hyperlight-JS cannot reliably infer host-function dependencies from arbitrary
JavaScript. Imports and property access can be dynamic, and runtime observation
would miss unexecuted branches.

The current safe behavior conservatively promotes required to the complete
available manifest whenever a handler or module is added after restoration.
This is correct but can overstate requirements and reduce snapshot portability.

Proposed solution

Add an optional API for declaring host-function requirements when registering
handlers and modules. Track requirements per registered item so removals can
recompute the resulting union.

Callers that omit declarations retain the conservative promotion behavior.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions