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(swingset): move upgrade() vatParameters into options bag #5365

Merged
merged 1 commit into from
Jun 1, 2022

Conversation

warner
Copy link
Member

@warner warner commented May 13, 2022

Previously, the parent vat did E(adminFacet).upgrade(vatParameters)

Now it does E(adminFacet).upgrade(bundleCap, { vatParameters })

This matches the way vatParameters are passed to the original
createVat() call.

All other options are rejected.

This changes the adminFacet API, but internally continues to send
vatParameters in their own argument to the underlying device
nodes. If/when we send actual options, we'll need to decide whether to
change the shape of the device node API by converting vatParameters
into options, or just add additional arguments.

closes #5345

@warner warner added the SwingSet package: SwingSet label May 13, 2022
@warner warner requested a review from FUDCo May 13, 2022 20:00
@warner warner self-assigned this May 13, 2022
Copy link
Contributor

@FUDCo FUDCo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor thing I really think should be tweak, but other than that it looks good to me.

@@ -98,7 +98,13 @@ export function buildRootObject(vatPowers) {
done() {
return doneP;
},
upgrade(bundlecap, vatParameters) {
upgrade(bundlecap, options) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

options should default to {}, so existing code that isn't using it don't need to change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. On second thought I'm not sure how downstream code will handle a missing vatParameters parameter. I had been thinking you could get away with leaving it off if you didn't have any parameters, and maybe you could have. If so, you should still be able to do that. If not, maybe you should.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

I guess omitting vatParameters in the upgrade should get you the same value as you'd get omitting it in the original createVat. That ought to be undefined, but now that I'm looking at the code, I'm not sure that's what happens. I'll add a test.

@warner warner force-pushed the 5345-upgrade-options branch from 62e9bde to 0725890 Compare May 26, 2022 06:58
@warner warner requested a review from FUDCo May 26, 2022 07:01
Copy link
Contributor

@FUDCo FUDCo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

は、私にはよく見えますよ

@warner warner force-pushed the 5345-upgrade-options branch from 0725890 to d3e2641 Compare June 1, 2022 18:19
@warner warner added the automerge:rebase Automatically rebase updates, then merge label Jun 1, 2022
Previously, the parent vat did `E(adminFacet).upgrade(vatParameters)`

Now it does `E(adminFacet).upgrade(bundleCap, { vatParameters })`

This matches the way `vatParameters` are passed to the original
`createVat()` call.

All other options are rejected. The `options` argument itself is
optional.

This changes the `adminFacet` API, but internally continues to send
`vatParameters` in their own argument to the underlying device
nodes. If/when we send actual options, we'll need to decide whether to
change the shape of the device node API by converting `vatParameters`
into `options`, or just add additional arguments.

closes #5345
@warner warner force-pushed the 5345-upgrade-options branch from d3e2641 to d26b872 Compare June 1, 2022 18:43
@mergify mergify bot merged commit cdf07ab into master Jun 1, 2022
@mergify mergify bot deleted the 5345-upgrade-options branch June 1, 2022 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge SwingSet package: SwingSet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vat upgrade should put vatParameters in an option bag
2 participants