-
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
feat(exo): instance testing #1925
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
erights
force-pushed
the
markm-exo-is-live-instance
branch
5 times, most recently
from
January 13, 2024 01:49
f481a88
to
e9bf65a
Compare
erights
force-pushed
the
markm-exo-is-live-instance
branch
2 times, most recently
from
January 13, 2024 22:58
b21c849
to
224af12
Compare
erights
force-pushed
the
markm-exo-is-live-instance
branch
2 times, most recently
from
January 15, 2024 00:44
c6015af
to
a81350a
Compare
erights
force-pushed
the
markm-exo-is-live-instance
branch
2 times, most recently
from
January 15, 2024 01:02
eff17bd
to
c5c30c6
Compare
erights
force-pushed
the
markm-remove-receiveRevoker
branch
from
January 16, 2024 19:00
e771700
to
3a39841
Compare
erights
force-pushed
the
markm-exo-is-live-instance
branch
4 times, most recently
from
January 18, 2024 04:58
62178ed
to
1ddc51a
Compare
FUDCo
approved these changes
Jan 18, 2024
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.
LGTM. Still wish we had a better word than "kit" though.
erights
force-pushed
the
markm-exo-is-live-instance
branch
from
January 19, 2024 01:09
1ddc51a
to
6eef38b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Now staged on #1964
closes: #XXXX
refs: #1924 #1964
Description
This PR adds a third meta-level rights amplification power: the power to tell if an object is a live instance of an exo class, or a live facet instance of an exo class kit.
After revoking and amplifying, the remaining obvious meta-level rights amplification power normally associated with classes is unforgeable instance testing. (In some ocap literature, this is sometimes referred to as "brand testing". But given ERTP's conflicting use of the term "brand", this is best avoided.)
Given revocability and our desire that all these meta-level powers be essentially free, these test only that an object is a live instance of the associated class, or a live facet instance of the associated class kit. In neither case do we distinguish between a revoked former instance vs any other non-live-instance value.
Security Considerations
In many OO languages, such as Java, access to a class bundles the ability to instantiate the class with the ability to reliably test for membership in the class. For exo classes and exo class kits, to follow the principles of least authority and information hiding, we decided to separate the two. As with the other meta-level rights amplification powers, these are not provided by default, and it is easy for a code review to see it they are provided at all, and where these powers might be used.
The obvious JavaScript test,
instanceof
, is not reliable. However, JavaScript classes do provide a reliable test viaprivate fields. Like the design in this PR, this power is initially present only within the lexical scope of the class. It is up to code within that lexical scope whether to make that power available to code elsewhere.
Scaling Considerations
Should be free, as it uses the
contextMap
indirection already present in exos.Documentation Considerations
For all these meta-level rights amplification powers, the inline doc-comments now contains adequate text to seed real documentation, especially when consulting the tests for illustrative examples. However, none of these are yet implemented for virtual or durable exos, and cannot be until agoric-sdk is upgraded to depend on an endo release incorporating this PR. Until then, we should probably hold back on more public documentation of these APIs.
Testing Considerations
This PR provided only tests for the heap-based exo implementations, which are all that the @endo/exo package provided. Once base-zone is migrated from agoric-sdk to endo, we should rewrite these tests using Zones so they are reusable for virtual and durable exos as well.
Upgrade Considerations
For all these meta-level rights amplification powers, which powers are provided might vary per incarnation. Since amplification and live instance testing are query only powers against representation that exists anyway, having these vary per incarnation should not be a problem. It remains to be seen whether this will also be true for revocation.