-
Notifications
You must be signed in to change notification settings - Fork 72
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
import-bundle: allow symbol-named properties in inescapableGlobalProperties #2376
Labels
Comments
warner
added a commit
that referenced
this issue
Jul 23, 2024
…balProperties Previously, the `inescapableGlobalProperties` option to `importBundle()` only accepted enumerable string-named properties. This commit changes that to accept all properties (even unenumerable ones), and to accept symbol-named properties (instead of only string-named ones). We'll use this to provide `passStyleOf` to the vat environment built by liveslots, so it can use a real WeakMap, instead of the (slower) "virtual object -aware WeakMap". closes #2376
Related: Agoric/agoric-sdk#9781 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the Problem Being Solved?
As discussed in the comments on #1676, we'd like to convey
passStyleOf
into vat environments via a symbol-named property on the global, rather than a string-named property on VatData.To support this, we need to change
import-bundle
to pay attention to symbol-named properties ofinescapableGlobalProperties
, because currently it usesObject.keys
, which ignores symbols and only copies the string-named properties into the child Compartment's global. We'll accomplish this by usingReflect.ownKeys
While we're at it, we'll change
import-bundle
to look for all own properties ofinescapableGlobalProperties
, not just the enumerable ones (which matches the change fromObject.keys
toReflect.ownKeys
).Description of the Design
Add tests. Change it to use
Reflect.ownKeys
.Security Considerations
None I can think of, whoever is calling
importBundle
is in control of what properties they put oninescapableGlobalProperties
, so if they want to make those properties unenumerable or Symbols, that's their business. And that party is in complete control over the guest/Compartment code's world.Scaling Considerations
none
Test Plan
unit tests
Compatibility Considerations
In the unlikely event that someone was already using Symbol-named properties, or unenumerable ones, in their
inescapableGlobalProperties
call, their guest code will start getting access to new properties, perhaps suprisingly. But that seems quite unlikely.Upgrade Considerations
To benefit from this, the host code must start using a new version of
import-bundle
. For the Agoric chain, that means a new version ofswingset-xsnap-supervisor
, so the process is:passStyleOf
endowment, and a new/current@endo/pass-style
, which pulls that endowment)The text was updated successfully, but these errors were encountered: