feat(swingset): devices.bundle, install-bundle, bundlecaps, createVat(bundlecap) #4485
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add kernel support for code "bundles", specifically objects with
{ moduleFormat: "EndoZipBase64" }
whose.EndoZipBase64
property is a largestring (base64-encoded zipfile with a compartment map and module components).
Each bundle has a "bundleID" which is the versioning prefix
b1-
followed bythe lowercase hex encoding of the SHA512 hash of the compartment map bytes.
Bundles are represented within userspace as "bundlecaps", which are device
nodes owned by a new "bundle device" (
devices.bundle
). These can be passedin messages from one vat to another, just like Remotables. Bundlecaps are
used to create vats in lieu of passing the actual (large) code bundles around
through messages. Bundlecaps can also be asked for their code bundle in case
you need to
importBundle
one directly into userspace (e.g. when ZCFevaluates a contract bundle).
The
config.bundles
table is now handled by installing the bundles atinitializeSwingset
time, and populating a name->ID table for later.The new APIs are:
computedBundleID = controller.validateAndInstallBundle(bundle, allegedBundleID)
will validate the bundle against the claimed ID and add itto the kernel tables (NOTE: validation is minimal so far, must be improved
before release)
kernel.installBundle(bundleID, bundle)
will install a bundle under thegiven ID without validation
devices.bundle
provides access to bundlesD(devices.bundle).getBundleCap(bundleID)
yields a bundlecap orundefined
if no bundle was installed with that IDD(devices.bundle).getNamedBundleCap(name)
yields a bundlecap orundefined
if config.bundles lacked a bundle with that nameD(bundlecap).getBundleID()
yields the bundleIDD(bundlecap).getBundle()
yields a code bundle, forimportBundle()
E(vatAdminService).createVat(bundleOrBundleCap)
creates a dynamic vatE(vatAdminService).createVat(bundlecap)
E(vatAdminService).createVatByName(name)
still works, but eventually itwill be removed in favor of userspace doing
getNamedBundleCap
firstcloses #4372