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

Dynamically create new vats. #410

Merged
merged 16 commits into from
Jan 23, 2020
Merged

Dynamically create new vats. #410

merged 16 commits into from
Jan 23, 2020

Conversation

Chris-Hibbert
Copy link
Contributor

@Chris-Hibbert Chris-Hibbert commented Jan 13, 2020

Doesn't handle termination.

Includes updates to tests.

The base change for the vatAdmin changes is here. See this discussion for context.

@Chris-Hibbert Chris-Hibbert force-pushed the provideVatId branch 2 times, most recently from 7fd2259 to e8cda0a Compare January 13, 2020 02:49
@Chris-Hibbert Chris-Hibbert force-pushed the createDynamicVats branch 2 times, most recently from 32b77a5 to f7c09eb Compare January 13, 2020 05:21
@Chris-Hibbert Chris-Hibbert requested a review from warner January 13, 2020 05:45
@warner
Copy link
Member

warner commented Jan 14, 2020

It looks like you disabled a whole bunch of tests.. was that intentional?

@Chris-Hibbert
Copy link
Contributor Author

Many non-SES tests failed, and I remembered @warner saying something indicating he that was likely ahead of time. As discussed off-line, Brian wasn't saying that was acceptable, so I'll go back and figure out what's necessary to re-enable them.

Copy link
Member

@warner warner left a comment

Choose a reason for hiding this comment

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

ok, I think there are some non-critical changes we can make to clean things up, but overall it looks sound and correct. I'm most interested in --without-ses working, and then my next priority is code cleanup so we can read this better in the future, followed by handling syntax errors in the new vat's code somehow.

packages/SwingSet/src/kernel/vatAdmin/vatAdmin.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/vatAdmin/vatAdmin-src.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
Copy link
Contributor Author

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

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

Since you looked at the code before, my recommendation is not to look at the new individual commits, but instead to review the entire PR as a diff against master.

packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/vatAdmin/vatAdmin-src.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/vatAdmin/vatAdmin.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
@Chris-Hibbert Chris-Hibbert requested a review from warner January 20, 2020 20:29
@warner
Copy link
Member

warner commented Jan 22, 2020

hm, could you make two changes to the patch series:?

  • combine the "add test.skip to all --no-ses tests" and the "remove test.skip from all --no-ses tests" patches, so they cancel out and disapear. I tried to rebase this to trunk and got conflicts in e.g. Zoe, which isn't touched in the overall diff, because of fleeting changes that then got undone. Like virtual particles caroming off an event horizon (or not). Should be a job for git rebase --interactive
  • rebase this to current master

Doesn't handle termination.

Includes updates to tests.

No longer skips non-SES tests to simplify merging. This means
non-SES tests are broken.
It has lots of internal state that doesn't need to leak.
Test changes have been split into a separate commit, since they invert
most of an earlier commit, and can be merged more cleanly separately.
Various other responses to review comments included.
Handle errors during vat creation (and add a test case).
Simplify registration of vat admin functions with vatAdmin Device
More refactoring for readability
@Chris-Hibbert Chris-Hibbert changed the base branch from provideVatId to master January 23, 2020 01:37
@Chris-Hibbert
Copy link
Contributor Author

There was a request to handle syntax errors in the new vat's code. See the brokenVatTest to decide whether you like the approach.

I merged out the skipping of non-SES tests, since it touched so many files. That meant that many intermediate commits wouldn't pass tests, but that's probably okay at this point.

This has now been rebased to current master.

@Chris-Hibbert Chris-Hibbert requested a review from warner January 23, 2020 01:55
Copy link
Member

@warner warner left a comment

Choose a reason for hiding this comment

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

I like where this is going!

packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/kernel.js Outdated Show resolved Hide resolved
packages/SwingSet/src/kernel/vatAdmin/vatAdmin-src.js Outdated Show resolved Hide resolved
Create serialized string directly when notifying adminVat.
Various renamings and comment clarifications.
Provide vat control functions directly, rather than providing an accessor.
Remove adminStats framework, since it's not complete here. Coming soon.
@Chris-Hibbert
Copy link
Contributor Author

I'll make separate PRs to 1) switch to imports rather than require() and 2) renaming kernelKeeper's
provide... functions.

I didn't add a distinct notification for the error case in vat creation. The adminVat finds out
immediately, and doesn't create a promise that would need to be rejected.

Copy link
Member

@warner warner left a comment

Choose a reason for hiding this comment

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

ok, let's land this now, and fix those two remaining issues (#444 and #445) in a second pass. Thanks!

@Chris-Hibbert Chris-Hibbert merged commit 4bde699 into master Jan 23, 2020
@Chris-Hibbert Chris-Hibbert deleted the createDynamicVats branch January 23, 2020 23:16
@@ -19,6 +19,9 @@ import { insistCapData } from './capdata';
import { parseVatSlot } from './parseVatSlots';
import { buildStorageInMemory } from './hostStorage';

const ADMIN_DEVICE_PATH = require.resolve('./kernel/vatAdmin/vatAdmin-src');
Copy link
Member

Choose a reason for hiding this comment

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

darn. More use of require.resolve. (ambient authority grumble... and doesn't work on xs)

I wish I had taken a look sooner.

@Chris-Hibbert
Copy link
Contributor Author

@dckc what would work better here? I wasn't happy with this, but I didn't find anything else that allowed the kernel to get access to source code to use for a built-in device and vat.

@dckc
Copy link
Member

dckc commented Jan 23, 2020

I hope import() works out better. I see discussion of further work in that direction above.

In particluar, import() skips access to the source code and just gives the exports back.

I suppose it doesn't help that much with the relative path resolution fuctionality of require.resolve.

If we have to expose reading source code from files in our APIs, we should use filesystem access objects, a la java's File or the Emily file API. Not ambient fs.readFileSync() access. See #66 (comment) and following.

@warner
Copy link
Member

warner commented Jan 24, 2020

I'd rather pass source code in to the SES realm/kernel (as a string) than pass in file-reading ability. But yeah, I think proper modules and import statements (note: not dynamic import() expressions) will help here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SwingSet package: SwingSet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants