-
Notifications
You must be signed in to change notification settings - Fork 212
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
passStyleOf endowment should be inescapable #9981
Labels
enhancement
New feature or request
Comments
warner
added a commit
that referenced
this issue
Aug 30, 2024
…Properties Previously, liveslots added the special `PassStyleOfEndowmentSymbol` on `vatGlobals`. This enabled the first-level vat bundle (the one that defines buildRootObject, e.g. ZCF) to use the same passStyleOf as liveslots is using, with a real WeakMap for its memoization cache. However, child Compartments of that vat, such as the ones contract bundles are loaded into, do not automatically get the same global, and ZCF does not pass any special options to `importBundle()`, which would enable that. This commit attaches the symbol to `inescapableGlobalProperties`, rather than `vatGlobals`. Those properties are automatically (indeed unavoidably) copied onto the `globalThis` of each child Compartment, recursively. This is stronger than we need: we're ok with a Compartment choosing to omit or change this property. This allows contract code which does `import { passStyleOf } from '@endo/pass-style'` to get the correct/fast/cheap version too. fixes #9981
stealing this one, I've got a patch |
warner
added a commit
that referenced
this issue
Aug 30, 2024
…Properties Previously, liveslots added the special `PassStyleOfEndowmentSymbol` on `vatGlobals`. This enabled the first-level vat bundle (the one that defines buildRootObject, e.g. ZCF) to use the same passStyleOf as liveslots is using, with a real WeakMap for its memoization cache. However, child Compartments of that vat, such as the ones contract bundles are loaded into, do not automatically get the same global, and ZCF does not pass any special options to `importBundle()`, which would enable that. This commit attaches the symbol to `inescapableGlobalProperties`, rather than `vatGlobals`. Those properties are automatically (indeed unavoidably) copied onto the `globalThis` of each child Compartment, recursively. This is stronger than we need: we're ok with a Compartment choosing to omit or change this property. This allows contract code which does `import { passStyleOf } from '@endo/pass-style'` to get the correct/fast/cheap version too. Tests were added to liveslots to assert that it gives the expected `inescapableGlobalProperties` option when asking the supervisor to build the vat's namespace, and to SwingSet to assert that both child and grandchild Compartments get the expected version of passStyleOf (which was not the case for mere `vatGlobals`). fixes #9981
mergify bot
added a commit
that referenced
this issue
Aug 31, 2024
…Properties (#10005) Previously, liveslots added the special `PassStyleOfEndowmentSymbol` on `vatGlobals`. This enabled the first-level vat bundle (the one that defines buildRootObject, e.g. ZCF) to use the same passStyleOf as liveslots is using, with a real WeakMap for its memoization cache. However, child Compartments of that vat, such as the ones contract bundles are loaded into, do not automatically get the same global, and ZCF does not pass any special options to `importBundle()`, which would enable that. This commit attaches the symbol to `inescapableGlobalProperties`, rather than `vatGlobals`. Those properties are automatically (indeed unavoidably) copied onto the `globalThis` of each child Compartment, recursively. This is stronger than we need: we're ok with a Compartment choosing to omit or change this property. This allows contract code which does `import { passStyleOf } from '@endo/pass-style'` to get the correct/fast/cheap version too. fixes #9981
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the Problem Being Solved?
#9874 updated liveslots to endow its child compartment global object with passStyleOf via a property keyed on a
@endo passStyleOf
symbol reserved this purpose, but @erights points out that ZCF probably uses a child compartment of its own, which should also have the same endowment.Description of the Design
Updating packages/swingset-liveslots/src/liveslots.js to declare
[PassStyleOfEndowmentSymbol]: passStyleOf
ininescapableGlobalProperties
rather thanvatGlobals
should ensure that all descendant compartments get the endowment and can import a passStyleOf that will use it rather than build on top of the virtual-object-aware WeakMap.Security Considerations
We already convinced ourselves that such an endowment is safe.
Scaling Considerations
This will provide the same benefits to contracts that are already anticipated for non-contract vats such as Zoe.
Test Plan
Performance measurement is highly desired if feasible.
Upgrade Considerations
Contracts will not get the benefits until upgrade to a version whose bundle includes an endowment-aware passStyleOf, or restart with a bundle that already includes it.
The text was updated successfully, but these errors were encountered: