Skip to content
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)!: makeZoeKit() now requires a zcfBundlecap #4528

Closed
wants to merge 5 commits into from

Conversation

warner
Copy link
Member

@warner warner commented Feb 10, 2022

fix(zoe)!: makeZoeKit() now requires a zcfBundlecap

Zoe needs access to the vatAdminSvc, to create a new ZCF vat to host each
contract. Previously, Zoe did E(vatAdminSvc).createVatByName('zcf'), and
assumed that vatAdminSvc had access to a vat source bundle by that name. Now,
whoever calls makeZoeKit() is obligated to provide Zoe with the right
bundlecap, and Zoe does E(vatAdminSvc).createVat(zcfBundlecap). This makes
things more explicit.

This changes the signature of makeZoeKit() in a non-backwards-compatible
way: the zcfBundlecap argument is now mandatory, and thus appears second,
replacing the old optional fourth-position zcfBundleName.

Swingset-based unit tests that use Zoe generally follow a pattern where
vat-zoe.js holds the makeZoeKit() call, and bootstrap.js sends vat-zoe
a buildZoe(vatAdminSvc) message. Those need to change: bootstrap should use
D(devices.bundle).getNamedBundleCap('zcf') to get the zcfBundlecap, and
send it through buildZoe(). vat-zoe should be changed to pass
zcfBundlecap into makeZoeKit().

A similar pattern should be used in actual deployments.

Non-swingset-based zoe-using unit tests generally use fakeVatAdmin.js to
build a mock vatAdminSvc. This commit changes fakeVatAdmin.js to include
an additional zcfBundlecap export, which is an empty marker object that
serves as a stand-in for the bundlecap. The fake vatAdminSvc can accept
this fake zcfBundlecap, and will evaluate the ZCF code appropriately.

Downstream module owners should grep their source code for makeZoeKit and
fakeVatAdmin to find the calls that need updating.

refs #4487

Zoe needs access to the vatAdminSvc, to create a new ZCF vat to host each
contract. Previously, Zoe did E(vatAdminSvc).createVatByName('zcf'), and
assumed that vatAdminSvc had access to a vat source bundle by that name. Now,
whoever calls makeZoeKit() is obligated to provide Zoe with the right
bundlecap, and Zoe does E(vatAdminSvc).createVat(zcfBundlecap). This makes
things more explicit.

This changes the signature of `makeZoeKit()` in a non-backwards-compatible
way: the `zcfBundlecap` argument is now mandatory, and thus appears second,
replacing the old optional fourth-position `zcfBundleName`.

Swingset-based unit tests that use Zoe generally follow a pattern where
`vat-zoe.js` holds the `makeZoeKit()` call, and `bootstrap.js` sends vat-zoe
a `buildZoe(vatAdminSvc)` message. Those need to change: bootstrap should use
`D(devices.bundle).getNamedBundleCap('zcf')` to get the `zcfBundlecap`, and
send it through `buildZoe()`. vat-zoe should be changed to pass
`zcfBundlecap` into `makeZoeKit()`.

A similar pattern should be used in actual deployments.

Non-swingset-based zoe-using unit tests generally use `fakeVatAdmin.js` to
build a mock `vatAdminSvc`. This commit changes `fakeVatAdmin.js` to include
an additional `zcfBundlecap` export, which is an empty marker object that
serves as a stand-in for the bundlecap. The fake `vatAdminSvc` can accept
this fake `zcfBundlecap`, and will evaluate the ZCF code appropriately.

Downstream module owners should grep their source code for `makeZoeKit` and
`fakeVatAdmin` to find the calls that need updating.

refs #4487
This updates all agoric-sdk packages which use Zoe in their unit tests, to
provide a `zcfBundlecap` to their `makeZoeKit()` calls.
@warner warner added Zoe package: Zoe deployment Chain deployment mechanism (e.g. testnet) wallet Zoe Contract Contracts within Zoe Inter-protocol Overarching Inter Protocol pegasus Governance Governance labels Feb 10, 2022
@warner warner self-assigned this Feb 10, 2022
@warner
Copy link
Member Author

warner commented Feb 11, 2022

Ugh the change to makeZoeKit and makeFakeVatAdmin means I need to update all the dapps too.

@warner
Copy link
Member Author

warner commented Feb 13, 2022

#4545 and #4544 are a better, less-invasive approach to this. By exposing the bundlecap-fetching APIs on vatAdminService, we get a promise-based API that can wait for a bundle to be installed (#4521) and we don't need to change the way dapp tests call makeFakeVatAdmin. Closing this in favor of those two.

@warner warner closed this Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment Chain deployment mechanism (e.g. testnet) Governance Governance Inter-protocol Overarching Inter Protocol pegasus wallet Zoe Contract Contracts within Zoe Zoe package: Zoe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant