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

add description to pass-by-presence objects? #28

Closed
warner opened this issue May 30, 2019 · 2 comments
Closed

add description to pass-by-presence objects? #28

warner opened this issue May 30, 2019 · 2 comments
Assignees
Labels
captp package: captp eventual-send package: eventual-send marshal package: marshal SwingSet package: SwingSet

Comments

@warner
Copy link
Member

warner commented May 30, 2019

For debugging (as well as general learn-by-experimentation), it would be nice to have a way to attach descriptions to the various pass-by-presence objects we fling around. The current situation is that these arrive as a Presence on the remote side, which is an empty harden()ed object with nothing to suggest what it's good for, where it came from, or what methods it might respond to.

The simplest improvement would to just make sure that .toString() can be (remotely) invoked, and establish a convention of including a toString() when you construct the object. This requires a roundtrip to do the lookup, and doesn't reveal any information to the kernel, so it's only usable from some other vat.

Another approach that we kicked around today would be to define a special symbol (a "registered Symbol", in JS parlance) that we use to attach a descriptive string. The construction-time syntax would look like:

const DESC = Symbol.for("description");
const p = harden({
  foo(args) { doStuff(); },
  [DESC]: 'I am a Foo that can do foo(args)',
});

The description string is the magic one: it would match something defined in liveSlots.js so the marshalling code can recognize the property. We could also pass the symbol into userspace the same we pass E.

To implement this, we'd need to change:

  • marshal.js: the presence of this Symbol shouldn't disqualify the object from pass-by-presence serialization
  • liveSlots.js: define the symbol, serialize pass-by-presence with an additional property (instead of just { type: 'export', id }, it needs to be { type: 'export', id, description })
  • the syscall.send and dispatch.deliver protocol must change to include the description on the first delivery of the presence record
  • vatManager.js needs to track exported presence records (which it doesn't currently track), to make sure we capture the description only on the first time the presence is exported from a vat. We need these to be immutable, and if a non-liveslots userspace decides to change the description each time it exports the same object, the kernel and other vats shouldn't see the changes.
  • kernel.js and the dump() function would benefit from including these descriptions in the printable representations of the kernel c-list tables
@warner warner transferred this issue from Agoric/SwingSet Dec 1, 2019
@warner warner added the SwingSet package: SwingSet label Dec 1, 2019
dckc pushed a commit to dckc/agoric-sdk that referenced this issue Dec 5, 2019
dckc pushed a commit to dckc/agoric-sdk that referenced this issue Dec 5, 2019
dckc pushed a commit to dckc/agoric-sdk that referenced this issue Dec 5, 2019
dckc pushed a commit to dckc/agoric-sdk that referenced this issue Dec 5, 2019
delay WeakMap until after xs preload
dckc pushed a commit to dckc/agoric-sdk that referenced this issue Dec 5, 2019
Previously, each syscall/dispatch API (and lots of internal interfaces, like
the run-queue) used an inconsistent variety of ways to pass the two halves of
"data that can include capability references": the string of serialized data,
plus the array of slots (like 'o+4' and 'p-4').

This defines a type (to the extent that one can define types in Javascript)
named "CapData" to hold "capability-bearing data". Instances of this type
contain exactly `{ body, slots }`. All API signatures that used to pass two
arguments now pass a single CapData-typed argument.

It also defines a type named "Message", which contains `{ method, args,
result }`, where `method` is a string that names the method to be invoked,
`args` is a CapData whose top-level member is an array (of positional
arguments), and `result` is either a promise reference or `null`/`undefined`.

"Message" is not revealed to Vats, but the various in-kernel run-queues and
delivery APIs are now written in terms of Messages rather than distinct
method / args / result fields.

This depends upon a new version of `@agoric/marshal` which uses CapData in
serialize/unserialize, rather than separate string and slots arguments.

refs Agoric#28
dckc pushed a commit to dckc/agoric-sdk that referenced this issue Dec 5, 2019
@erights erights added captp package: captp eventual-send package: eventual-send marshal package: marshal labels Apr 19, 2020
@erights
Copy link
Member

erights commented Apr 19, 2020

See #804

@erights
Copy link
Member

erights commented Feb 26, 2021

As an aid to debugging under benign conditions, done. Closing.

@erights erights closed this as completed Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
captp package: captp eventual-send package: eventual-send marshal package: marshal SwingSet package: SwingSet
Projects
None yet
Development

No branches or pull requests

2 participants