-
Notifications
You must be signed in to change notification settings - Fork 208
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
store: refuse keys that are empty pass-by-copy objects #2585
Conversation
0d6dc4f
to
21ab960
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.
LGTM
@erights can you help me with the typescript problem? The PR fails lint and I don't know how to give the helper function a type that will satisfy it. |
You deleted helper.js but didn't push helpers.js |
bc001b9
to
1288439
Compare
oops, fixed |
ah, right, this needs to land on top of a cleanup in cosmic-swingset (#2567) which violates the rule we're imposing |
Btw, in Zenhub you declare that this PR is blocked on #2567 |
When #2018 changes the interpretation of `harden({})` to become pass-by-copy, any code which was previously using that to make a "handle" will break, because the things they send will be treated as pass-by-copy. To catch cases where this is happening, we forbid such keys from being used in store/weakstore. Clients should use `Far('interfacename')` to create handles, and these will be accepted by store/weakstore as keys.
83286e3
to
c38a4dc
Compare
To protect against surprises when we change
harden({})
from pass-by-reference to pass-by-copy (#2018), @michaelfig and I figured that the simplest safety measure would be to havestore
/weakstore
refuse such keys.This branch adds these checks, as well as a bunch of unit tests (it appeared to have none before).
I could use some help from a TypeScript guru, I can't seem to find a way to satisfy the signature of the helper function.