-
Notifications
You must be signed in to change notification settings - Fork 208
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
define worker-v1 package #6596
Comments
Perhaps we should make the bundle files for this package during the build process (and publish them to NPM), so their contents are well-specified. Every
Having a yarn.lock should enforce that. There will be a very limited set of changes that could possibly be made (between the original |
We cannot rely on |
(That is, if |
This creates a new `@agoric/swingset-liveslots` package, which owns the old `packages/SwingSet/src/liveslots/` code. Several tests which specifically exercised liveslots (but not the rest of the kernel) were moved over, along with some helper files. The "fake virtual stuff" tools in SwingSet/tools/ were moved over too. No file contents were changed, so the new files won't work yet (and this breaks SwingSet itself), until we modify them in the next commit. This "move, then modify" approach should help with git rebasing and history management in the future, as well as code review. New files were created for the metadata: package.json, jsconfig.json. The agoric-cli `sdk-package-names.js` file was regenerated to include the new package. refs #6596
This creates a new `@agoric/swingset-liveslots` package, which owns the old `packages/SwingSet/src/liveslots/` code. Several tests which specifically exercised liveslots (but not the rest of the kernel) were moved over, along with some helper files. The "fake virtual stuff" tools in SwingSet/tools/ were moved over too. No file contents were changed, so the new files won't work yet (and this breaks SwingSet itself), until we modify them in the next commit. This "move, then modify" approach should help with git rebasing and history management in the future, as well as code review. New files were created for the metadata: package.json, jsconfig.json. The agoric-cli `sdk-package-names.js` file was regenerated to include the new package. refs #6596
This creates a new `@agoric/swingset-liveslots` package, which owns the old `packages/SwingSet/src/liveslots/` code. Several tests which specifically exercised liveslots (but not the rest of the kernel) were moved over, along with some helper files. The "fake virtual stuff" tools in SwingSet/tools/ were moved over too. No file contents were changed, so the new files won't work yet (and this breaks SwingSet itself), until we modify them in the next commit. This "move, then modify" approach should help with git rebasing and history management in the future, as well as code review. New files were created for the metadata: package.json, jsconfig.json. The agoric-cli `sdk-package-names.js` file was regenerated to include the new package. refs #6596
This creates a new `@agoric/swingset-liveslots` package, which owns the old `packages/SwingSet/src/liveslots/` code. Several tests which specifically exercised liveslots (but not the rest of the kernel) were moved over, along with some helper files. The "fake virtual stuff" tools in SwingSet/tools/ were moved over too. No file contents were changed, so the new files won't work yet (and this breaks SwingSet itself), until we modify them in the next commit. This "move, then modify" approach should help with git rebasing and history management in the future, as well as code review. New files were created for the metadata: package.json, jsconfig.json. The agoric-cli `sdk-package-names.js` file was regenerated to include the new package. refs #6596
This creates a new `@agoric/swingset-liveslots` package, which owns the old `packages/SwingSet/src/liveslots/` code. Several tests which specifically exercised liveslots (but not the rest of the kernel) were moved over, along with some helper files. The "fake virtual stuff" tools in SwingSet/tools/ were moved over too. No file contents were changed, so the new files won't work yet (and this breaks SwingSet itself), until we modify them in the next commit. This "move, then modify" approach should help with git rebasing and history management in the future, as well as code review. New files were created for the metadata: package.json, jsconfig.json. The agoric-cli `sdk-package-names.js` file was regenerated to include the new package. refs #6596
(hm, ok that may or may not torpedo the following plan) I've spent more time thinking about this. The constraints are:
We have two bundles used to start an xsnap worker. The first is named "the lockdown bundle", and currently the entry point is import { setObjectInspector } from './console-shim.js';
import '@endo/init';
import confinedObjectInspect from './confined-object-inspect.js';
setObjectInspector(confinedObjectInspect);
harden(console); The second is named "the supervisor bundle", and the entry point is Our bundles include the package name, package version, and relative pathnames of every file in the bundle, including the entry point. To generate identical bundles, it is not sufficient for the entrypoint file to have the same contents: it must also live in the same package, of the same package version, and at the same relative path. That means The PlanSo that makes me think the following plan could work: The light blue boxes represent packages, at various versions. The blue connecting lines are cross-package dependencies. The white boxes are JS files or JS-level exports of the package, and the black connecting lines are The The "worker-v1" support is provided by a package named The first is
The second is a package named The lockdown package exports two API functions. The first is Alternatively, we might choose to have The third package is the "supervisor package", which will live in The XS Compatibility LevelsWhen considering moving from one version of XS to another, we must think about how similar the new version behaves, compared to state or actions created under the previous version. There are two things for the new behavior to be compatible with:
A failure of new-delivery consistency would cause a validator to fall out of consensus. A failure of replay consistency might be caught by the individual validator as it noticed a discrepancy between the transcript-recorded syscalls (or delivery results) and the replay. Now we can classify potential changes in XS behavior into 4-ish categories:
Changing XSThe compatibility level of XS determines how we might deploy it to the chain. A-level compatiblitySince A-level changes to XS do not cause observable behavior differences, we should be able to deploy them at any time. We would publish a new version of Validators could switch to the new kernel at their leisure, without requiring a coordinated chain upgrade event. B-level compatibilityIf the XS changes are classified as "B-level", then the upgrade process requires conformance testing (and a little bit of luck, given that it might take a week from the time testing must stop to the time a chain-upgrade vote can complete). We'd produce the same packages as above, but we'd bump the minor version (e.g. (note: maybe the minor version isn't the right component to change; we might need four levels of version number to capture all of this). C-level compatibiltiyFor C-level changes, the kernel will need to run both old and new versions for some period of time (since not all vats will reach their BOYD+heap-snapshot point at the same moment, and that moment certainly doesn't happen at the moment of chain upgrade). Therefore we must allocate a new The new kernel version would depend upon both D-level compatibilityFor D-level changes, we definitely need separate It seems likely that the kernel might not automatically upgrade vats across this boundary. Instead, the kernel upgrade changes the default "what worker should new vats use?" value, which can also be the value used when upgrading an existing vat. Then, userspace (e.g. contract governance committee action) causes a vat upgrade for each vat, and the bundles change during that upgrade. Changing Endo/SES, or LiveslotsWe create a new version of |
So here's a plan of attack:
|
It would be great if during this process every file ended up as a git move so we can keep history somewhat traceable. |
Agreed, although I don't know how to make copies trigger git's heuristic. OTOH, if you're following it with |
This extracts the XS supervisor bundle out of packages/SwingSet and into a new package whose NPM name is `@agoric/swingset-xs-supervisor`, and lives (for now) in packages/swingset-xs-supervisor . The bundle is created explicitly, by running `yarn build`. As with `xsnap-lockdown`, the intention is that eah published version has a stable bundle, with specific (hashable) contents. Importing clients can rely upon this stability to e.g. have deterministic xsnap heap snapshot contents even if the versions of other parts of the system have changed. The new README.md describes the API, the stability goals, and how we achieve them. Fairly soon, we'll need manage the version number of this package more explicitly, either by moving it to a different git repository, or changing out use of `lerna publish` to avoid spurious changes. But for now we can leave it in place. refs #6596
This extracts the XS supervisor bundle out of packages/SwingSet and into a new package whose NPM name is `@agoric/swingset-xs-supervisor`, and lives (for now) in packages/swingset-xs-supervisor . The bundle is created explicitly, by running `yarn build`. As with `xsnap-lockdown`, the intention is that eah published version has a stable bundle, with specific (hashable) contents. Importing clients can rely upon this stability to e.g. have deterministic xsnap heap snapshot contents even if the versions of other parts of the system have changed. The new README.md describes the API, the stability goals, and how we achieve them. Fairly soon, we'll need manage the version number of this package more explicitly, either by moving it to a different git repository, or changing out use of `lerna publish` to avoid spurious changes. But for now we can leave it in place. refs #6596
This extracts the XS supervisor bundle out of packages/SwingSet and into a new package whose NPM name is `@agoric/swingset-xs-supervisor`, and lives (for now) in packages/swingset-xs-supervisor . The bundle is created explicitly, by running `yarn build`. As with `xsnap-lockdown`, the intention is that eah published version has a stable bundle, with specific (hashable) contents. Importing clients can rely upon this stability to e.g. have deterministic xsnap heap snapshot contents even if the versions of other parts of the system have changed. The new README.md describes the API, the stability goals, and how we achieve them. Fairly soon, we'll need manage the version number of this package more explicitly, either by moving it to a different git repository, or changing out use of `lerna publish` to avoid spurious changes. But for now we can leave it in place. refs #6596
This extracts the XS supervisor bundle out of packages/SwingSet and into a new package whose NPM name is `@agoric/swingset-xsnap-supervisor`, and lives (for now) in packages/swingset-xsnap-supervisor . The bundle is created explicitly, by running `yarn build`. As with `xsnap-lockdown`, the intention is that eah published version has a stable bundle, with specific (hashable) contents. Importing clients can rely upon this stability to e.g. have deterministic xsnap heap snapshot contents even if the versions of other parts of the system have changed. The new README.md describes the API, the stability goals, and how we achieve them. Fairly soon, we'll need manage the version number of this package more explicitly, either by moving it to a different git repository, or changing out use of `lerna publish` to avoid spurious changes. But for now we can leave it in place. refs #6596
This extracts the XS supervisor bundle out of packages/SwingSet and into a new package whose NPM name is `@agoric/swingset-xsnap-supervisor`, and lives (for now) in packages/swingset-xsnap-supervisor . The bundle is created explicitly, by running `yarn build`. As with `xsnap-lockdown`, the intention is that eah published version has a stable bundle, with specific (hashable) contents. Importing clients can rely upon this stability to e.g. have deterministic xsnap heap snapshot contents even if the versions of other parts of the system have changed. The new README.md describes the API, the stability goals, and how we achieve them. Fairly soon, we'll need manage the version number of this package more explicitly, either by moving it to a different git repository, or changing out use of `lerna publish` to avoid spurious changes. But for now we can leave it in place. refs #6596
This moves the xsnap-worker-creation code out of SwingSet and into a new package, whose NPM name is `@agoric/swingset-worker-xsnap-v1`, and lives (for now) in packages/swingset-worker-xsnap-v1 . This new package encapsulates: * the choice of `xsnap` executable, hence the XS engine version inside * the choice of `@agoric/xsnap-lockdown`, hence the Endo/SES version * the choice of `@agoric/swingset-xsnap-supervisor`, hence liveslots We roughly expect there will be exactly one version of `@agoric/swingset-worker-xsnap-v1` published. Any major changes to XS/xsnap/SES/liveslots will be published to a new `@agoric/swingset-worker-xsnap-v2` package, and a single kernel can depend upon both -v1 and -v2 at the same time, to support older vats (started with -v1) as well as newer vats (started with, or upgraded to, -v2). Minor (and sufficiently backwards-compatible) changes of the components may be possible. If so, we can publish new versions of -v1, and deployed systems can perform orchestrated (within-consensus) upgrades from e.g. -v1@1.0 to -v1@1.1 . We still need to think carefully about potential differences in behavior between the first-run deliveries (using 1.0) and the post-upgrade replayed deliveries (using 1.1). SwingSet now has a primary dependency on the new `@agoric/swingset-worker-xsnap-v1` package, and only `devDependencies` on the individual components (`@agoric/swingset-xsnap-supervisor` and `@agoric/xsnap-lockdown`). Hopefully these dev-dependencies will go away once the dust settles. refs #6596
This moves the xsnap-worker-creation code out of SwingSet and into a new package, whose NPM name is `@agoric/swingset-worker-xsnap-v1`, and lives (for now) in packages/swingset-worker-xsnap-v1 . This new package encapsulates: * the choice of `xsnap` executable, hence the XS engine version inside * the choice of `@agoric/xsnap-lockdown`, hence the Endo/SES version * the choice of `@agoric/swingset-xsnap-supervisor`, hence liveslots We roughly expect there will be exactly one version of `@agoric/swingset-worker-xsnap-v1` published. Any major changes to XS/xsnap/SES/liveslots will be published to a new `@agoric/swingset-worker-xsnap-v2` package, and a single kernel can depend upon both -v1 and -v2 at the same time, to support older vats (started with -v1) as well as newer vats (started with, or upgraded to, -v2). Minor (and sufficiently backwards-compatible) changes of the components may be possible. If so, we can publish new versions of -v1, and deployed systems can perform orchestrated (within-consensus) upgrades from e.g. -v1@1.0 to -v1@1.1 . We still need to think carefully about potential differences in behavior between the first-run deliveries (using 1.0) and the post-upgrade replayed deliveries (using 1.1). SwingSet now has a primary dependency on the new `@agoric/swingset-worker-xsnap-v1` package, and only `devDependencies` on the individual components (`@agoric/swingset-xsnap-supervisor` and `@agoric/xsnap-lockdown`). Hopefully these dev-dependencies will go away once the dust settles. refs #6596
This moves the xsnap-worker-creation code out of SwingSet and into a new package, whose NPM name is `@agoric/swingset-worker-xsnap-v1`, and lives (for now) in packages/swingset-worker-xsnap-v1 . This new package encapsulates: * the choice of `xsnap` executable, hence the XS engine version inside * the choice of `@agoric/xsnap-lockdown`, hence the Endo/SES version * the choice of `@agoric/swingset-xsnap-supervisor`, hence liveslots We roughly expect there will be exactly one version of `@agoric/swingset-worker-xsnap-v1` published. Any major changes to XS/xsnap/SES/liveslots will be published to a new `@agoric/swingset-worker-xsnap-v2` package, and a single kernel can depend upon both -v1 and -v2 at the same time, to support older vats (started with -v1) as well as newer vats (started with, or upgraded to, -v2). Minor (and sufficiently backwards-compatible) changes of the components may be possible. If so, we can publish new versions of -v1, and deployed systems can perform orchestrated (within-consensus) upgrades from e.g. -v1@1.0 to -v1@1.1 . We still need to think carefully about potential differences in behavior between the first-run deliveries (using 1.0) and the post-upgrade replayed deliveries (using 1.1). SwingSet now has a primary dependency on the new `@agoric/swingset-worker-xsnap-v1` package, and only `devDependencies` on the individual components (`@agoric/swingset-xsnap-supervisor` and `@agoric/xsnap-lockdown`). Hopefully these dev-dependencies will go away once the dust settles. refs #6596
I'm thinking about how the repos and packages and workspaces ought to work, and how a "test against current versions of everything" (#7056) should work. Tools at our disposal:
The new package dependency graph is: graph TD;
swingset-kernel --> swingset-worker-xsnap-v1;
swingset-worker-xsnap-v1 --> xsnap;
swingset-worker-xsnap-v1 --> xsnap-lockdown;
xsnap-lockdown --> endo/init;
swingset-worker-xsnap-v1 --> swingset-xsnap-supervisor;
swingset-xsnap-supervisor --> swingset-liveslots;
and the goal is to allow "thorough but painful" approachOne potential approach, with obvious drawbacks:
This would achieve our stability goals, but development would be horrible: every commit would have to go through NPM before the parent package could use it. We'd be publishing broken versions because we couldn't actually test the combination of new-child + new-parent before committing to the new-child patch. "special kernel development workspace" approachWe might create a separate repo for use by kernel developers. It would define a yarn-v1 One problem is that The non-kernel agoric-sdk code would continue to use a kernel from NPM, making a boundary between swingset and its clients that would have to go through NPM for each change (same problem as above, but at a different boundary, hopefully one which changes more slowly). Devs who want to test both sides could use "yarn link all the things"Another approach would be to use
Depending on the versions and constraints, this would replace e.g. When it comes time to publish a version to NPM, we'd use "one repo but mess with workspaces a lot"In this approach, we continue to use a single monorepo, but we use a release process that temporarily changes the definition of the workspace.
Development can continue in the tree, and running tests with When it comes time to release the swingset packages, the sequence will look like:
Note that all of the swingset package release tags will point to commits on the side branch, and each will point to a distinct commit. We must also change the agoric-sdk release/publish process:
The swingset packages will spend most of their time at "something using a newer Yarn"We're currently using yarn-v1, and support for workspaces has improved significantly in the later versions (currently yarn-v3.5.0). One improvement is the ability to use nested workspaces, called "worktrees". We could use this to nest a set of swingset packages in one workspace, under the general agoric-sdk workspace. Another improvement is a dependency constraint syntax that says "only use something from my same workspace", spelled like which one?I'm still trying to figure out a good plan here. |
Oh, before I forget, any change which creates new repos or workspaces will need to consider the |
I haven't completely absorbed this, but a couple of somewhat scattered thoughts which possibly don't necessarily reflect the strongest possible understanding of the yarn/npm/git/blahblah toolchain:
|
This is the first time I'm actually thinking about this problem, and I may be missing something, but I don't understand the direction taken right now, or the process taken to get there. In particular, a single "worker-v1" package amalgaming xsnap, endo, liveslots, and various dependencies. I'm having an easier time thinking of it this problem in terms of API surface and upgradable units, and starting from the program itself. I also want to think about this as what the right approach conceptually should be, but it may not be feasible right now without other work throughout our stack. Code running in a workerVat programIf we look at a JavaScript program executing in a vat, it has dependencies on the environment created by liveslots and endo, and possibly a dependency on a certain set of JS features. The program may also have dependencies on remote objects or devices, which are not part of the environment, but may be part of the initial execution of the program (currently defined as While these are dependencies in the conceptual sense, from the perspective of the program's One approach would be to have an Zoe contractsBut looking at liveslots programs is only part of the picture. Most of the programs running in a vat are actually Zoe contracts, which rely on a specific version of the Zoe Contract Facet to invoke it (through an exported Let's take an example. Let's say ZCF itself relies on the basic "liveslots@^1.0" feature set and documents it as such in its There is also the question of how the Zoe contract expresses its reliance on Supervisor bundleOn the other side, we have the supervisor bundle. This currently evaluates as a script, but it may not stay like that (for example it could transition to an endo worker which I believe expects a For an xsnap supervisor, an For example, we may move vatstore inside the worker, which would likely be a breaking change in the liveslots protocol between the kernel and the supervisor, and well as possibly in the protocol between the kernel and the worker process. However this may be transparent on the vat program itself, and only necessitate a minor version update of "liveslots" from its point of view. WorkerThis is the final and lowest level component in a vat, the one providing a hardened JS execution environment for the supervisor bundle, as well as the low level transport with the kernel (some of which is exposed to the supervisor, like the commands interface, and some which is only exposed to the kernel, like snapshots). As such it may provide 2 "engines" versions to the supervisor (e.g. "endo" + a worker specific one like "xsnap"), but it also needs some independent versioning with the kernel. For example, a breaking change in an xsnap worker would be to change the snapshot format, but that would have no bearing on the supervisor or vat bundles executing in the vat (beyond the fact that changing the xsnap worker version requires going through the "upgrade" process for the vat program since we cannot restore the program's heap). On the other side, a change to the metering API may be a breaking change between the xsnap worker and the supervisor, but may not impact the transport between the xsnap-worker process and the kernel. Version requirements and checksAll this suggests that when creating or upgrading a vat, the "endo" and "liveslots" versions should be specified explicitly or derived from the bundle. However the xsnap or liveslot protocol versions are in fact transitive dependencies that do not belong expressed or checked at that layer. The major version of the worker would not be part of the options either: a null upgrade would implicitly use the latest major version of the worker compatible with the required "endo" and "liveslots" versions, and it then becomes a question of who triggers the null upgrade. Swingset would need to handle multiple supervisor bundles and worker major versions. However these 2 don't have to be merged together (but can be to simplify things). More importantly, their versions is not directly equivalent to the "endo" and "liveslots" versions that the vat bundle requires. This points to the need for the following mechanisms:
For example we could have the following layering:
At first, only the version
In a chain upgrade, version In another chain upgrade,
Handling multiple versionsThis requires the kernel to be aware of multiple versions of xsnap-worker / supervisor. Right now those cannot be introduced dynamically, so we can rely on source code changes in the kernel every time the xsnap-worker or supervisor changes. One approach could be to always rely on NPM installed versions for the non latest package, and some dependency aliasing so that the kernel can depend on multiple versions of these packages. This does make it complicated to do patch or minor updates to the non-latest version, and does not prevent the supervisor from changing due to repo effects, unless the supervisor is published as a bundle. However since we've disconnected the xsnap package and supervisor versions from the endo and liveslots versions they provide, I'm wondering if we actually need actual publishable node packages for these. On the xsnap side, we really have a binary and a JS spawner. The binary is mostly in an external repo already, and we could keep the above scheme, aka install a binary version published by an xsnap repo which just builds xsnap-pub with the right moddable SDK. For "latest" work, we could keep a way to build the binary from a submodule instead. Then on the JS spawner side, we could have separate non published packages or even more simply source files that correspond to the various "xsnap-worker" versions, which would internally reference the required binary. These JS spawners could share some source code where applicable. Similarly, for the supervisor, if we're careful to not have dependencies influenced by the rest of the repo, we could keep the different versions as sibling folders and files in the repo. To ensure we don't break our requirements of no changes to previous versions, we could either check-in the resulting bundle, or a hash of the expected bundle, for each version. |
I had a good brainstorming session with @michaelfig and @mhofman this morning, and I think we have a better plan than before:
That will get us stability of the two bundles for the lifetime of a vat incarnation. The stability is low-level (precise bundle contents, as opposed to a version string), which is good. We won't directly have a semver/human-meaningful name for that behavior: we'll talk about "the liveslots that shipped with When we perform the agoric-sdk release process, we'll get a new semver version string for each bundle-creating package, and we'll create (and hash) a bundle as well. We won't learn the bundle's hash until that moment. The bundles ought to be reproducible: clone the SDK at that commit, that will include a particular Updating something in the agoric-sdk (e.g. with TODO: make sure the generated bundles are included in the NPM package (run After the vaults release, we'll need to decide how we get the second version of the bundles into place. One option is a
Other options/variants:
Note: a top-level xsnapFor now, we won't record any per-vat metadata to describe which version of This will constrain our ability to change XS/xsnap: any change we make must be sufficiently compatible to not cause problems when replaying a transcript (the old XS and the new XS must match transcripts) (this may be easier once #7142 is fixed and we're more confident that liveslots ignores GC timing variations). We'll pretend that there's a per-vat metadata key that says which version of xsnap to use, and that it's currently set to "0" (i.e. lack of a key means "0"). Later, when we want to introduce a not-so-compatible version of XS/xsnap, we'll start using this key. At that point, we'll either need separately named That is the point at which we'll figure out the semver attributes of these different xsnap packages, what "minor version has changed" means w.r.t. compatibility, etc. We can avoid committing ourselves to some of those details until we need the second version/package. At that time, we'll update the kernel to record "current xsnap version identifier" into the DB, and use it when launching the worker. My original plan was to change the In our new thinking, Currently, Then, the git commit ID of the |
This extracts the XS supervisor bundle out of packages/SwingSet and into a new package whose NPM name is `@agoric/swingset-xsnap-supervisor`, and lives (for now) in packages/swingset-xsnap-supervisor . The bundle is created explicitly, by running `yarn build`. As with `xsnap-lockdown`, the intention is that each published version has a stable bundle, with specific (hashable) contents. Importing clients can rely upon this stability to e.g. have deterministic xsnap heap snapshot contents even if the versions of other parts of the system have changed. The new README.md describes the API, the stability goals, and how we achieve them. Fairly soon, we'll need manage the version number of this package more explicitly, either by moving it to a different git repository, or changing our use of `lerna publish` to avoid spurious changes. But for now we can leave it in place. refs #6596
I believe @michaelfig suggested we could do this lazily and just load the bundle and hash from disk when needed by a new vat.
Is that true for all packages or only the ones with circular dependencies? I thought yarn correctly handled the order for packages that have no circular deps. |
This extracts the XS supervisor bundle out of packages/SwingSet and into a new package whose NPM name is `@agoric/swingset-xsnap-supervisor`, and lives (for now) in packages/swingset-xsnap-supervisor . The bundle is created explicitly, by running `yarn build`. As with `xsnap-lockdown`, the intention is that each published version has a stable bundle, with specific (hashable) contents. Importing clients can rely upon this stability to e.g. have deterministic xsnap heap snapshot contents even if the versions of other parts of the system have changed. The new README.md describes the API, the stability goals, and how we achieve them. Fairly soon, we'll need manage the version number of this package more explicitly, either by moving it to a different git repository, or changing our use of `lerna publish` to avoid spurious changes. But for now we can leave it in place. refs #6596
Yeah, as I wrote up my notes, I got worried about when exactly the DB writes would occur, and how we explain this to host-application authors. Let's see, I can think of three approaches:
I need to be able to write documentation aimed at host-app authors to explain when state changes might happen, and what their "A" is the one that most closely matches the current pattern. It would always sample and stash the bundles during const { hostStorage, kernelStorage } = openSwingStore(dbPath);
if (timeToUpgrade) {
updateSwingset(kernelStorage);
hostStorage.commit();
}
const c = buildVatController(kernelStorage);
// .. go run blocks DB writes are a deterministic function of the package upgrade schedule and the host app calling the "upgrade" function. "B" might be convenient, but the host app would need to do a commit at every launch, just in case this was the time that a new bundle was found. DB writes would be a function of package upgrade schedule and the controller incarnation schedule (process start to process termination). The host startup would look something like: const { hostStorage, kernelStorage } = openSwingStore(dbPath);
const c = buildVatController(kernelStorage);
hostStorage.commit(); // in case bundle upgrades happened
// .. go run blocks "C" puts the changes in the middle of a It also adds a new failure mode: if someone launches the kernel, then modifies their source tree (e.g. checks out a different version, maybe temporarily), the DB state will depend on a race between their interference and a vat being created. If we used A or B, any potential sampling would be complete by the time kernel startup finished, so the window of vulnerability (to this admittedly "don't do that" case) is a lot smaller. My Python t-shirt says "explicit is better than implicit":
But the annoying thing about "A" (explicit) is that we have to add a cosmic-swingset Hrm. I know I don't want to do "B". I prefer to be explicit. I think I'm ok with e.g. swing-store either spontaneously upgrading itself (when newer code is launched against an older DB), or refusing to run and requiring a separate program be run to do the upgrade, which suggests that maybe I'm ok with the kernel spontaneously upgrading the bundles without an explicit upgrade() call, which means that maybe explicit is not so important to me after all. I'm uncomfortable with deferring the bundle reads until semi-random times long after kernel startup. We're not saving and significant space or time by loading the bundles lazily. But I don't want to implement the extra cosmic-swingset actions or coordination code to trigger the swingset upgrade, nor do I really want to add "call Ok, I'll go with "C". At least with these reasons written down, if I change my mind later, I should be able to think more clearly about it. |
A corollary to "C": do the sampling once on controller initialization, but don't write the results to the DB until the first time they're needed. |
I don't fully follow the timing issues: The packages providing the bundles would be loaded when loading swingset, but their methods to load the bundle and check the bundle hash would be invoked every time a vat is created. The authority is already encapsulated, no need to provide new raw authority to read the filesystem. If someone modifies their source tree in a way that will cause the existing methods to return new values, then they will just fall off consensus. Aka don't change your source tree while executing, any lazy loading will have similar constraints. Edit: to summarize, "C", but I don't share the concerns. |
Now that we have a new approach, I'm moving this ticket out of the milestone in favor of the (smaller) #7208 . We might choose to use this approach in the future, but we no longer think we need a distinct |
I move to close this issue since it is no longer on the plan of record. We can revive the idea if it eventually becomes necessary to have more than one worker version. |
What is the Problem Being Solved?
To give us a coherent solution for #6361 , I think we need to define a new package that includes all the behavior-influencing parts of our XS-based workers. This package will have
-v1
in the name, not the version, and in fact we will only ever publish a single version of this package: all subsequent changes will go into a new package, with-v2
in the name, which will also only get one release, etc.Then we change SwingSet to depend upon this
-v1
worker package, and add a note to the kernelDB per-vat metadata to record the fact that the incarnation is using v1, rather than some earlier or later version. Any version of SwingSet can host this worker and its history (especially its XS heap snapshots) without fear of behavior changes.The nominal name of the new package is
@agoric/worker-v1
, but we might want something more swingset-specific.Description of the Design
@agoric/worker-v1
will need to contain or import the contents of:packages/SwingSet/src/supervisors/subprocess-xsnap/
packages/SwingSet/src/liveslots
(also used by other workers, and a lot of kernel unit tests)packages/xsnap
packages/SwingSet/src/lib/
The kernel-facing API of this package should let it launch a worker and get back control facets to send deliveries down and process syscalls that come back.
Security Considerations
Test Plan
The text was updated successfully, but these errors were encountered: