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

Inscrutable durableMapStore.get(deviceNode) exception for a missing key #7105

Closed
michaelfig opened this issue Mar 2, 2023 · 0 comments · Fixed by #7233
Closed

Inscrutable durableMapStore.get(deviceNode) exception for a missing key #7105

michaelfig opened this issue Mar 2, 2023 · 0 comments · Fixed by #7233
Assignees
Labels
bug Something isn't working liveslots requires vat-upgrade to deploy changes vaults_triage DO NOT USE

Comments

@michaelfig
Copy link
Member

Describe the bug

@FUDCo writes:

Trying to get something that’s not there from a MapStore is an error while doing the same from a Map returns undefined, and though you do get an error (per spec), the specific error you happen to get is sort of incidental and not very useful for purposes of diagnosing what’s the matter.

To Reproduce

Steps to reproduce the behavior:
0. do this in a new SwingSet vat

  1. Create a fresh durableMapStore (called dms in this recipe)
  2. execute dms.get(device) where device is a device not otherwise used by the vat
  3. See error ending with:
2023-03-01T22:36:16.655Z SwingSet: ls: v9: Logging sent error stack (Error#1)
2023-03-01T22:36:16.655Z SwingSet: ls: v9: Error#1: no ordinal for Object [Alleged: device] {}
2023-03-01T22:36:16.655Z SwingSet: ls: v9: Error: no ordinal for (an object)
 at construct ()
 at Error (/bundled-source/.../node_modules/ses/src/error/tame-error-constructor.js:56)
 at makeError (/bundled-source/.../node_modules/ses/src/error/assert.js:242)
 at fail (/bundled-source/.../node_modules/ses/src/error/assert.js:370)
 at encodeRemotable (/bundled-source/.../packages/swingset-liveslots/src/collectionManager.js:233)
 at encodePassable (/bundled-source/.../node_modules/@endo/marshal/src/encodePassable.js:348)
 at keyToDBKey (/bundled-source/.../packages/swingset-liveslots/src/collectionManager.js:278)

Expected behavior

dms.get(device) should throw with something like:

Error#1: key not found: [Alleged: device] {}

Platform Environment

  • what OS are you using? what version of Node.js? MacOS w/ Node.js 16.18.1
  • is there anything special/unusual about your platform? not pertinent to this problem
  • what version of the Agoric-SDK are you using? agoric-upgrade-8-1037-g80de089d3

Additional context

I suspect the existing tests use the MapStore "properly" so they didn't see this exception.

If I do the proper MapStore membership check first, then the error is avoided:

const value = dms.has(device) ? dms.get(device) : undefined;
@michaelfig michaelfig added bug Something isn't working liveslots requires vat-upgrade to deploy changes labels Mar 2, 2023
@FUDCo FUDCo self-assigned this Mar 2, 2023
@michaelfig michaelfig changed the title Inscrutable MapStore.get(deviceNode) exception for a missing key Inscrutable durableMapStore.get(deviceNode) exception for a missing key Mar 2, 2023
@ivanlei ivanlei added the vaults_triage DO NOT USE label Mar 2, 2023
@mergify mergify bot closed this as completed in #7233 Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working liveslots requires vat-upgrade to deploy changes vaults_triage DO NOT USE
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants