-
Notifications
You must be signed in to change notification settings - Fork 206
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
fix(zoe): add zoe.installBundleID #4598
Conversation
1c25c8d
to
7e72ade
Compare
ee4bc63
to
7d49244
Compare
This changes a handful of Zoe tests (to confirm that the new behavior works). It does not yet change the rest of the zoe tests, nor the tests elsewhere in agoric-sdk, nor the tests in dapps that live outside agoric-sdk. I need to change all of those before I can remove the old I also made a small swingset change to export a few types that are now part of the Zoe API ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why *Bundlecap
instead of *BundleCap
? Since none of this has been merged yet, if we're going to rename it, now is the ideal time.
7d49244
to
94cf61b
Compare
0691275
to
fd0d323
Compare
94cf61b
to
9278694
Compare
fd0d323
to
bfb1acc
Compare
9278694
to
861cf62
Compare
bfb1acc
to
daa5ba2
Compare
11e9da7
to
f1ed862
Compare
0bca84e
to
bf37d71
Compare
dcee1ab
to
c09ea83
Compare
* bundle?: SourceBundle, | ||
* bundleCap?: BundleCap, | ||
* bundleID?: BundleID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking but FYI, we can use unions to convey mutual exclusion. It has the advantage over optionals of guaranteeing to consumer that one of them is defined. E.g.,
type BundleOrBundleCap = {bundle: SourceBundle} | {bundleCap: BundleCap, bundleId: BundleID};
or in jsdoc,
/** @typedef { {bundle: SourceBundle} | {bundleCap: BundleCap: bundleId} } BundleOrBundleCap */
then intersection for the return type
Promise<BundleOrBundleCap & {installation: Installation}>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aye, thanks, will look into that later, there's another BundleOrBundleCap
floating around which doesn't include the bundleID
that I don't want to collide with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collide with
Want to point out that the possibility of collisions is due to ambient types. Because TypeScript is structurally typed, there's usually little problem with redundant definitions. (Besides code maintenance/documentation.)
c09ea83
to
ee1ab7a
Compare
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
ee1ab7a
to
0fad95f
Compare
fix(zoe): add zoe.installBundleID
To transition Zoe from full contract bundles to bundlecaps, this adds a new
install API.
E(zoe).install(bundle)
is unchanged, but the new preferredapproach is
E(zoe).installBundleID(bundleID)
. This requires thecorresponding bundle to be installed with the swingset kernel's
vatAdminService, either before or after
installBundleID()
(zoe will waitforever for the bundle to be installed).
Zoe
Installation
objects retain theirgetBundle()
method to accomodatedapp 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 bothvalidate 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'sevaluateContract()
method accepts either a bundlecap or a full bundle.closes #4563