Giter Club home page Giter Club logo

Comments (7)

timfpark avatar timfpark commented on August 24, 2024 2

Let me know if there is an outline of what this work entails and if it is a suitable first time issue for newcomer. If so I would be happy to help!

from atrium.

sugyan avatar sugyan commented on August 24, 2024 1

I believe that with the #96 and #98 update, records containing embedded images can now be deserialized correctly and the error should no longer occur.

from atrium.

monaqa avatar monaqa commented on August 24, 2024

Facing the same problem.
I suspect that the following issue of ciborium crate is related.

enarx/ciborium#71

from atrium.

sugyan avatar sugyan commented on August 24, 2024

I'm currently working on resolving this issue and expect to fix it by applying #96.
I believe serde_ipld_dagcbor is more appropriate than ciborium for deserializing data in DAG-CBOR format, including cid, and I have submitted a pull request for one issue there
ipld/serde_ipld_dagcbor#21
I think that once these are resolved, we can deserialize all messages correctly. Please wait a bit until the new version comes out.

from atrium.

str4d avatar str4d commented on August 24, 2024

Tested using latest atrium-api (plus #121), and patching in ipld/serde_ipld_dagcbor@ffae329 (which includes ipld/serde_ipld_dagcbor#23), using the following code to deserialize a post containing an embedded image:

let post: app::bsky::feed::post::Record = serde_ipld_dagcbor::from_reader(&data[..])?;

When no additional atrium-api features are enabled, I get the following error:

Error: Msg("data did not match any variant of untagged enum BlobRef")

When I enable the dag-cbor feature of atrium-api, the post parses correctly.

And for completeness, if I enable the dag-cbor feature of atrium-api but don't patch serde_ipld_dagcbor, I get this error:

Error: Msg("Only bytes can be deserialized into a CID")

from atrium.

sugyan avatar sugyan commented on August 24, 2024

@str4d Yes, that's right!
The CidLink deserialization uses a slightly odd method because the schema is different for JSON format and for DAG-CBOR format: to accommodate both formats, the deserialize method converts once to Ipld to determine the format. But this seemed to have some overhead.

Benchmark for checking it: https://github.com/sugyan/atrium/blob/main/atrium-api/benches/cid-link.rs
(Looks like we need libipld_core in dev-dependencies...)

So I implemented CidLink for DAG-CBOR as an additional feature, because I thought it is better to use only simple JSON objects if the user knows that the user will only use JSON format.
Sorry for the lack of documentation.

...But now we should probably use types::string::Cid for the link string of cid_link_json as well, and then it would be useless to worry about the overhead anymore, so maybe we can make it the default implementation.

from atrium.

sugyan avatar sugyan commented on August 24, 2024

This is resolved at #98

from atrium.

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.