Giter Site home page Giter Site logo

ibid mechanism broken about agoric-sdk HOT 9 CLOSED

agoric avatar agoric commented on July 26, 2024
ibid mechanism broken

from agoric-sdk.

Comments (9)

warner avatar warner commented on July 26, 2024

Can you make this into a unit test? I just tried a simple set of arrays (serialize([a1,a2,a3,a3,a2,a1])) and it seems to serialize correctly, but that case isn't introducing any new objects in the post-replacer data, and it sounds like that's the core problem.

The test should probably go into test-marshal.js in "serialize exports". If you can write a test that fails and post it here (or put it on a branch), I'll try to find the fix.

from agoric-sdk.

katelynsills avatar katelynsills commented on July 26, 2024

from agoric-sdk.

katelynsills avatar katelynsills commented on July 26, 2024

I added a unit test here: Agoric/SwingSet@e6c6350

from agoric-sdk.

warner avatar warner commented on July 26, 2024

Ah, yeah, this will be tricky. We're saving a lot of code by relying upon the built-in JSON serialization features. But the replacer hook of JSON.stringify is executed on the way into each node during a depth-first traversal, while the reviver hook of JSON.parse is run on the way out of each node. As a result, numbering the nodes by order of appearance to these hooks gets a completely different ordering.

Worst case we'll have to write our own deserializer. It might also be possible to serialize the data, unserialize it (without a reviver), then re-serialize it with a replacer that changes the ibid index for each node to match the other numbering order. Or do the same thing on the receiving side. Neither is particularly appealing.

from agoric-sdk.

erights avatar erights commented on July 26, 2024

I have some ideas here, to talk about when we're next in at the same time. In the meantime, Agoric/SwingSet@508982d safely turns ibids off in a way that should work well enough in the absence of cycles. However, it will expand pass-by-copy dags into trees.

from agoric-sdk.

warner avatar warner commented on July 26, 2024

That quick fix sounds good, and our marshalling layer will already combine multiple refs to the same import/export slot into a single index (even without the ibid mechanism). I'll land that now, and then we can defer the full fix until later.

from agoric-sdk.

dckc avatar dckc commented on July 26, 2024

Can you use a path rather than an index, a la cycle?

from agoric-sdk.

erights avatar erights commented on July 26, 2024

Can you use a path rather than an index, a la cycle?

Perhaps. Opened https://github.com/Agoric/SwingSet/issues/66 to track. Closing this one though, since ibids with indexes are no longer broken.

from agoric-sdk.

warner avatar warner commented on July 26, 2024

in the old repo. this was SwingSet issue 30

from agoric-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.