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

finish removing Node.js-based injected metering #3518

Closed
warner opened this issue Jul 24, 2021 · 0 comments
Closed

finish removing Node.js-based injected metering #3518

warner opened this issue Jul 24, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request SwingSet package: SwingSet

Comments

@warner
Copy link
Member

warner commented Jul 24, 2021

What is the Problem Being Solved?

We've committed to using xsnap for any computation that needs to be metered: the overhead of injected (Node.js) metering is pretty high, especially the initial translation/evaluation step, and we're committed to using xsnap anyways. We've removed some pieces of the old injected metering, but I'm running into a few small problems (typescript annotations) that would be easiest to solve if we just remove the vestigal remainders.

design

My plan is to delete the endowments (transformMetering, meterManager, replaceGlobalMeter) that get handed down from controller to kernel to local-vat-manager, which are used to support within-vat metering (transform functions granted through globals, getMeter supplied to the injected code but not userspace code via lexicals) and the supervisor-helper code that knows how to reset the global meter at the end of each crank.

Since "local" (Node.js) vats won't be able to do metering any more, I intend to have them assert that metered === false, to avoid any confusion.

Part of #3308 will be to change the dynamic vat default from metered: true to metered: false (because when that lands, metering will require a separately-constructed Meter object, making it awkward to offer a default with metering turned on). So I'll need to modify all current users of dynamic vats (Zoe's ZCF facet, the spawner, the tests/swingsetTests/ of treasury/sharing-service/governance/ERTP/zoe/spawner) to add metered: true. The assertion above means those test programs must also set config.defaultManagerType = 'xs-worker', since the default local worker will no longer accept metered: true. Applications which use metered dynamic vats will need to use xs-worker as well; our two primary applications (the chain, ag-solo) already do.

@warner warner added enhancement New feature or request SwingSet package: SwingSet labels Jul 24, 2021
@warner warner added this to the Testnet: Metering Phase milestone Jul 24, 2021
@warner warner self-assigned this Jul 24, 2021
warner added a commit that referenced this issue Jul 24, 2021
Swingset will soon change from "all dynamic vats are metered" to "dynamic
vats are unmetered by default", so set "metered: true" to retain the current
behavior for ZCF vats.

In addition, metering is going to be removed from the "local" (Node.js)
vat-worker, so "metered: true" will require "xs-worker" (xsnap) instead. This
changes the `tests/swingsetTests` runners to use xs-worker.

Note that this upcoming change means any application which uses Zoe to spawn
ZCF vats must run with `config.defaultManagerType='xs-worker'`, otherwise vat
creation will fail when Zoe asks for a metered vat. Our two primary
applications (the chain and the solo machine) both do this already.

refs #3518
refs #3308
warner added a commit that referenced this issue Jul 24, 2021
We no longer care about injected (Node.js) -based metering: XS is the only
platform where we can reasonably+efficiently meter code.

This removes support for passing `{ managerType: 'local', metered: true }` to
`createVat()`. Doing so will throw an exception when the vatManager is
invoked. Using just `{ metered: true }` is also an error when the swingset
`config.defaultManagerType` is not set to `xs-worker`. Applications that want
metered dynamic vats (i.e. all of them) should set `config.defaultManagerType
= 'xs-worker'` to avoid this.

This commit removes support throughout swingset:
* `transformMetering` is no longer passed from controller to kernel to the
local vatManager, and the transform is no longer applied to
`inescapableTransforms` to ensure sub-Compartments are also transformed
* `getMeter` is no longer placed on `inescapableLexicals`
* `replaceGlobalMeter` is no longer passed through to `supervisor-helper`,
where it was used to disable metering at the end of each crank
* the kernel `meterManager` facilities were removed
* all tests of metering non-XS workers are removed, including a test that
exercised sub-Compartments (which was specific to the injection approach)

Some tests have been modernized slightly, to use `controller.kpResolution`
instead of appending strings to testLog, and to use `prepare-test-env-ava`
instead of `@agoric/install-ses`.

Dependency updates:

Swingset no longer uses `@agoric/install-metering-and-ses`, or the
`tame-metering`/`transform-metering` packages. A vestigal dependency on
`babel-parser` (left over from the transform-tildot days) was removed.
Swingset still depends upon `babel-standalone`, to pre-load before `lockdown`
in `prepare-test-env-ava`.

closes #3518
@warner warner closed this as completed in 5b95638 Jul 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SwingSet package: SwingSet
Projects
None yet
Development

No branches or pull requests

1 participant