-
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
feat(zoe): caretaker-style revocable, ownable #8745
Conversation
6d41337
to
1ed06db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any important problems.
I defer to @Chris-Hibbert to approve.
c059b25
to
a41737f
Compare
a41737f
to
0fd1c06
Compare
0fd1c06
to
3550eee
Compare
3550eee
to
b66a66c
Compare
9da6e5d
to
e6c56b1
Compare
@dckc |
For adding generated docs, an example to follow is After you add stuff like that, run |
At api-docs/modules/_agoric_zoe.src_contractSupport_prepare_ownable.html I like it! |
ac042a2
to
cd4e790
Compare
@dckc |
Done. Now they are just in the zoe/contractSupport module. They get kinda lost in there, bit altogether it seems like the right thing to do. Opinions? |
Yeah... I think we're at the "better than nothing" stage of developing reference docs. |
@dckc , do you have any remaining concerns? |
ef316d3
to
512239d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closes: #XXXX
refs: #8020 #8517 #2070
Description
Alternative to #8020 and #8517
Unlike #8020 provides a caretaker-style revoker, which is a much better base for building ownables
Unlike #8517 provides ownables that are much easier to layer on top of existing implementations.
The basic idea of an "ownable object" is to provide general and lower level support for approximately the pattern that vaults implement manually in an adhoc manner: A ownable object is an object with a
makeTransferInvitation
method that revokes the object itself, in the sense of inactivating it — it no longer provides any authority. Instead, the exclusively transferable portion of its authority is encapsulated by the returned invitation, in an allegedly legible manner. That invitation can be redeemed, via anoffer
, for a new ownable object in which the transferable authority from the original ownable object is now exercisable.We call this an "ownable object" since rights of ownership include
Objects are about rights to exercise (use) and share, but not exclusive transfer, and not legibly.
ERTP is about legible exclusive transfer but not exercise.
The lifecycle of an ownable object, transmuting between an ephemeral ownable object and an invitation to get a new “equivalent” ownable object, combines all attributes together. But the attributes are never directly present at the same time. That’s why it is the lifecycle that combines these.
This notion of "ownable" and "ownership rights" has strong echoes in programming language notions of "ownership types", "linear types", "affine types", and "reference capabilities", in languages ranging from Rust to Pony to Move, enable mutable objects that can be exercised (use) and exclusive transfer, but not legibility.
However, none of these, as far as we are aware, has the two-phase lifecycle of our ownable objects. Thus, they do they provide for legibility of offers to transfer, which is crucial for secure exchange and offer safety. To produce a legible description of the transferable right (which we include in the invitation
customDetails
), we need to simultaneously stabilize the object, denying any further exercise until the invitation is redeemed. Otherwise, the "seller" could seem to be selling something whose value is invalidated by the seller's own further use.See Necessity specifications for robustness
See https://groups.google.com/g/cap-talk/c/9OU9ZNoB3os/m/gXeu2zs4AgAJ?utm_medium=email&utm_source=footer for a useful real-world analogy for the two-phase ownership cycle.
Security Considerations
Must ensure that revocation really denies all further authority from the original ownable object, even from messages that are already in the air but not yet delivered.
Need to verify that the legibility can meet invitation legibility goals.
Scaling Considerations
The kind of intrinsic revocability of #8020 could provide scaling benefits of dropping bookkeeping for used-up objects such as payments. However, we are not currently pursuing that revocation plan. It is conceivable that we could do something similar with the caretaker-like revocability of this PR, but we do not currently plan to do so.
Documentation Considerations
Once ready to be used, not only should this be documented, we should be able to simplify several other APIs in ways that should make them more explainable.
Testing Considerations
First tests are included.
Upgrade Considerations
Given that these are used with the durable zone, as intended: