-
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
Cannot JSON.stringify Remotables #2207
Comments
This debugging display was only possible due to endojs/endo#559 . That PR was motivated by the experience of trying to figure out why #2178 was failing, which was finally diagnosed as this bug. |
I will try to comment on this more fully, but please don't assume that the flattening of presences is unintended. Several of the data structures are conveyed over json already. Different paths are used when speaking captp. |
Excellent news! Looking forward to understanding this. Thanks. |
Fixed by fixing #2018 |
On the left we see a call to
JSON.stringify
in lib-wallet.js. On the right we see in the debugger an expansion of thevalues
argument being stringified. We see at the lower right that, at[0].value[0]
this includeshandle
,installation
, andinstance
. Currently these are simply empty objects, and this stringifies them as empty objects. However, these are actually remotables. As explained at #804 and #2018 (expecially #2018 (comment) ) we must declare them asRemotable
instead, as #2178 does.This debugger screenshot is from debugging #2178 where these are properly declared
Remotable
. However, these are still stringified as empty objects. The breakage at https://github.com/Agoric/agoric-sdk/pull/2178/checks?check_run_id=1707115405 is due to this. What happens is whenagoric-sdk/packages/dapp-svelte-wallet/api/test/test-lib-wallet.js
Lines 491 to 497 in 5ad007a
first does a
JSON.parse
to recover this structure, which turns these remotables back into plain empty objects, and then does an avadeepEqual
comparison with what should be the equivalent structure but had not gone through this information loss.To fix this correctly, we should use marshal's
serialize
andunserialize
rather than JSON'sstringify
andparse
. But I don't know what the purpose of the stringification inlib-wallet.js
is, so I don't know what a correct fix is.#2178 is blocked on this. Attn @michaelfig
There are a tremendous number of calls to
JSON.stringify
throughout our code. I have no idea if others have similar problems, but I worry.The text was updated successfully, but these errors were encountered: