-
Notifications
You must be signed in to change notification settings - Fork 207
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
add zoe.installBundleID(bundleID) #4563
Comments
Ok, to avoid the flag day, I'll split this into two pieces. This ticket is about changing
Once that lands, we'll start the process of converting dapps to install their bundles first and send an ID. When that process is complete, we'll remove the alternatives and the remaining Zoe API will be |
Previously, `E(zoe).install()` accepted a source bundle. Now it accepts either a source bundle, or a "bundle ID". The ID is a hash-based identifier string that refers to a bundle installed into the kernel via `controller.validateAndInstallBundle()`, and is retrievable from vatAdminService. Zoe exchanges the ID for a bundlecap, and retains the bundlecap for future use (including passing to the new ZCF vat, which converts it into a source bundle for evaluation at the last possible moment). The kernel install step can happen either before or after `E(zoe).install`, because the id-to-bundlecap conversion waits until the kernel install is complete. This begins the process of making Zoe work exclusively with (small) bundlecaps, and not (large) source bundles. The next step is to modify all unit tests and external callers (including deploy scripts, #4564) to kernel-install their bundle and use a bundleID for the Zoe install() invocation. After that is complete, #4565 will remove support for full bundles, and `E(zoe).install(bundleID)` will be the only choice. closes #4563
@erights and others have talked me into using a parallel public API, rather than a union type within the existing API. That means choosing a new name. I'll start with (New names are always frustrating, especially for a crew like ours that puts so much energy into getting the names right the first time around, which leaves less room for improvement. So here's the public API changes I'll be making:
Internally:
|
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with vatAdminService, either before or after `installBundleID` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects no longer have any methods on them (the previous `getBundle` would only work for bundle-based installations). A new `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it only works for bundleID-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundlecap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with vatAdminService, either before or after `installBundleID` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects no longer have any methods on them (the previous `getBundle` would only work for bundle-based installations). A new `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it only works for bundleID-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundlecap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundlecap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundlecap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundlecap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundlecap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundleCap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundleCap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundleCap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundleCap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundleCap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundleCap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundleCap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundleCap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundleCap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
To transition Zoe from full contract bundles to bundlecaps, this adds a new install API. `E(zoe).install(bundle)` is unchanged, but the new preferred approach is `E(zoe).installBundleID(bundleID)`. This requires the corresponding bundle to be installed with the swingset kernel's vatAdminService, either before or after `installBundleID()` (zoe will wait forever for the bundle to be installed). Zoe `Installation` objects retain their `getBundle()` method to accomodate dapp tests that have not switched to the new approach, but it throws an error if used on a new bundleID-based installation. A new method named `E(zoe).getBundleIDFromInstallation(allegedInstallation)` can be used to both validate the installation and get back the bundleID, but it throws on the old bundle-based installations. Internally, the installationStorage.unwrapInstallation now returns either `{ bundle, installation }` or `{ bundleCap, bundleID, installation }`. ZCF's `evaluateContract()` method accepts either a bundlecap or a full bundle. closes #4563
What is the Problem Being Solved?
As part of the path towards contract/vat upgrade, I need Zoe to treat contract source code as
bundlecap
handles, not (large) bundle objects. With #4372 we have the kernel support, but we need to change the way Zoe manages the "installations" table, as well as change the API.Zoe distinguishes an "installation" (akin to a class) from an "instance". Each installation has a single contract code bundle. Each instance of that installation has its own vat. The vat is launched with the ZCF bundle, and then Zoe tells ZCF to evaluate the contract bundle.
The current API is:
E(zoe).install(bundle)
. I want to change that toE(zoe).install(bundleID)
, wherebundleID
is a string that includes a hash of the bundle contents. Zoe usesvatAdminService
to look up this ID and retrieve abundlecap
, and then stores just a bundlecap. When Zoe tells ZCF which contract to use, it sends the bundlecap. ZCF is responsible for retrieving the actual source code (usingbundle = D(bundlecap).getBundle()
) so it can do theimportBundle()
. By leaving the contract's identity as a bundlecap until the last possible moment, we can reduce the size of messages, and give us some wiggle room to get Endo more involved in the process (eventuallyimportBundle(bundlecap)
should be a service provided by the vat environment, and overlap somehow with JS's native dynamicimport
expression).For that to work, you must install the bundle first, by talking to the kernel. That means the host application needs to be involved. For the chain, that will require a new cosmos transaction type (#4396), which calls
controller.validateAndInstallBundle
. The contract deployment process must change: the deploy script needs a way to sign and send this transaction first, learn the bundleID, then send the ID toE(zoe).install
instead of the bundle.I'm currently expecting that this will need a flag day, which is always horrible. If we were ok with
E(zoe).install(bundleOrID)
, we could avoid it, but that will complicate the necessary Zoe changes.Unit test code must be changed too. In looking at the Zoe unit tests, a common pattern is:
that changes to:
(the Bundle ID is normally
b1-
followed by a SHA512 hash of the bundle's compartment map, but the fake vatAdminService allows any string, so we use a made-up ID for the contracts used in the test)Description of the Design
Security Considerations
Test Plan
The text was updated successfully, but these errors were encountered: