-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle named bundles in kernel config and core-bootstrap #4374
Comments
#4372 takes For now, |
The new bootstrap code landed a while ago. It currently grabs the whole bundle and passes it to the old const bundleCap = D(vatAdmin).getNamedBundleCap(name);
const bundle = D(bundleCap).getBundle();
producer.resolve(E(zoe).install(bundle)); To avoid holding the whole bundle, we need to give bootstrap a way to get from a name to a bundleID, so it can use This wasn't straightforward when we first landed the bundle-handling code, because IDs (hashes) weren't always present (there was still a lot of placeholder code). But these days,
An alternative would be to add |
This API takes the name of a statically-configured bundle (i.e. a property name of `config.bundles`) and returns its BundleID (a hash string). This can be used later in `E(zoe).installBundleID(id)`. refs #4374 , specifically this API will allow bootstrap to deal with bundleIDs and bundleCaps rather than bundles.
This API takes the name of a statically-configured bundle (i.e. a property name of `config.bundles`) and returns its BundleID (a hash string). This can be used later in `E(zoe).installBundleID(id)`. refs #4374 , specifically this API will allow bootstrap to deal with bundleIDs and bundleCaps rather than bundles.
|
@dckc or @kriskowal please sync with @warner to see if this really is necessary for MN-1, and whether already done. |
My understanding is that all the bundle id / hash bundle stuff is motivated by the goal of setting a max message size around 10M or so; that is: this is blocking #4280 .
|
We moved #4280 to MN-1.1, so I'm moving this one, too. |
@dckc and I implemented this today, at least for the statically-installed contract bundles. core-bootstrap That removes the processing of the large contract bundle from both vat-bootstrap and vat-zoe. Zoe converts the BundleID into a BundleCap at installation time, and then sends the BundleCap to ZCF (instead of the full bundle) at instantiation time. I need to do another pass through Incidentally, when looking at the vat-zoe slogfile for a recent instagoric perf run, I counted 25 bundles being passed to |
Re-reading my initial comments.. to finish this work, and make all the bootstrap-launched pseudo-static vats use bundlecaps instead of bundle names, we need to change const vatInfo = E(svc).createVatByName(bundleName, { name: bundleName }); to something like:
Two wrinkles:
This second change doesn't save any RAM, because we aren't holding these full bundles in RAM at any point: both names and bundlecaps are tiny. So we don't really need to implement this any time soon. It's just a blocker for cleaning up vat-admin to stop supporting |
Likely a blocker for #6826 |
Rereading this, I think we need to apply one of the changes explored here (in #4374 (comment)) to address #6826, but I think we don't need to implement the rest of this ticket (which remains low-priority). Having |
The core-bootstrap `installBootContracts()` step is responsible for creating Zoe installations for each "boot contract": contracts that are included in the initial chain configuration, and instantiated during bootstrap (currently just `centralSupply` and `mintHolder`). These contract bundles are specified by config.bundle entries, which provide a `sourceSpec` that points to the bundle file on disk. Previously, this step obtained a full bundle for each contract, in RAM, and then used `zoe.install(bundle)` to create the Zoe Installation. When called this way, Zoe must store the full bundle (about 1MB) in its durable storage, and the bundle appears as a message argument in lots of places on its way to being evaluated inside a ZCF vat, which slows things down and consumes more disk space. The preferred way to interact with bundles is through BundleCaps. This commit changes installBootContracts to look up the BundleID of each boot contract, and submit the ID to `zoe.installBundleID()`. This allows Zoe to retrieve a (small) BundleCap, and store the bcap in the installation record. With this approach, the full bundle only appears once, when the ZCF vat retrieves its contents just prior to evaluation. Changing installBootContracts is straightforward, however we have a number of mock Zoe and mock VatAdminService implementations that appear during unit tests, and these required changes to accomodate the new approach. `zoe/tools/fakeVatAdmin.js` provides the primary mock service, but it is only capable of creating ZCF vats. It was augmented to understand the full suite of `getBundleIDByName`/etc methods, with helper tools to populate the simulated tables. Then `vats/tools/boot-test-utils.js` acquired a wrapper around zoe's mock service, adding the ability to create non-ZCF vats, and populating the tables with all the bundles known to the unit tests. refs #6826 refs #4374
The core-bootstrap `installBootContracts()` step is responsible for creating Zoe installations for each "boot contract": contracts that are included in the initial chain configuration, and instantiated during bootstrap (currently just `centralSupply` and `mintHolder`). These contract bundles are specified by config.bundle entries, which provide a `sourceSpec` that points to the bundle file on disk. Previously, this step obtained a full bundle for each contract, in RAM, and then used `zoe.install(bundle)` to create the Zoe Installation. When called this way, Zoe must store the full bundle (about 1MB) in its durable storage, and the bundle appears as a message argument in lots of places on its way to being evaluated inside a ZCF vat, which slows things down and consumes more disk space. The preferred way to interact with bundles is through BundleCaps. This commit changes installBootContracts to look up the BundleID of each boot contract, and submit the ID to `zoe.installBundleID()`. This allows Zoe to retrieve a (small) BundleCap, and store the bcap in the installation record. With this approach, the full bundle only appears once, when the ZCF vat retrieves its contents just prior to evaluation. Changing installBootContracts is straightforward, however we have a number of mock Zoe and mock VatAdminService implementations that appear during unit tests, and these required changes to accomodate the new approach. `zoe/tools/fakeVatAdmin.js` provides the primary mock service, but it is only capable of creating ZCF vats. It was augmented to understand the full suite of `getBundleIDByName`/etc methods, with helper tools to populate the simulated tables. Then `vats/tools/boot-test-utils.js` acquired a wrapper around zoe's mock service, adding the ability to create non-ZCF vats, and populating the tables with all the bundles known to the unit tests. refs #6826 refs #4374
The core-bootstrap `installBootContracts()` step is responsible for creating Zoe installations for each "boot contract": contracts that are included in the initial chain configuration, and instantiated during bootstrap (currently just `centralSupply` and `mintHolder`). These contract bundles are specified by config.bundle entries, which provide a `sourceSpec` that points to the bundle file on disk. Previously, this step obtained a full bundle for each contract, in RAM, and then used `zoe.install(bundle)` to create the Zoe Installation. When called this way, Zoe must store the full bundle (about 1MB) in its durable storage, and the bundle appears as a message argument in lots of places on its way to being evaluated inside a ZCF vat, which slows things down and consumes more disk space. The preferred way to interact with bundles is through BundleCaps. This commit changes installBootContracts to look up the BundleID of each boot contract, and submit the ID to `zoe.installBundleID()`. This allows Zoe to retrieve a (small) BundleCap, and store the bcap in the installation record. With this approach, the full bundle only appears once, when the ZCF vat retrieves its contents just prior to evaluation. Changing installBootContracts is straightforward, however we have a number of mock Zoe and mock VatAdminService implementations that appear during unit tests, and these required changes to accomodate the new approach. `zoe/tools/fakeVatAdmin.js` provides the primary mock service, but it is only capable of creating ZCF vats. It was augmented to understand the full suite of `getBundleIDByName`/etc methods, with helper tools to populate the simulated tables. Then `vats/tools/boot-test-utils.js` acquired a wrapper around zoe's mock service, adding the ability to create non-ZCF vats, and populating the tables with all the bundles known to the unit tests. refs #6826 refs #4374
We're going to kick this out out of the release.. I want to survey the code and understand how bundles are now being used, but the release isn't threatened by this not being done yet. |
What is the Problem Being Solved?
Once we have bundlecaps (#4372), we'd like the new #4165 / #4247 "core bootstrap" scheme to use them too. Currently this relies upon
vatAdminService~.createVatByName(name)
, rather than a bundlecap or bundleID.That means changing the kernel config format to somehow handle named bundles properly. We want vats to uniformly defined by a bundleID, so that the future upgrade protocol has a well-defined initial value to upgrade from.
The old code processes a
config.bundles
section which maps bundle names to either a filename (from whichbundleSource
can create a bundle) or an actual bundle (used only by tests). It then builds a table of named bundles, whichvatAdminService~.createVatByName()
can reference. @dckc 'sThe new approach should process
config.bundles
and install each bundle, then build a table mapping name to bundleID. Thebootstrap()
message should be enhanced to provide this table to the bootstrap vat (perhaps through a third argument, sobootstrap(vats, devices, bundles)
), which can usedevices.bundle
to get bundlecaps, and send them tovatAdminService~.createVat(bundlecap)
.When we're done, we can remove
createVatByName
, andcreateVat()
(which exclusively take a bundlecap) will be the only remaining API.Description of the Design
Security Considerations
Test Plan
The text was updated successfully, but these errors were encountered: