-
Notifications
You must be signed in to change notification settings - Fork 17
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
Graphsync 2.0 refactors: Bind node part 1 - message #301
Comments
How precise is this statement? The main issue I'm aware of is map key sorting between cbor-gen and everything else, including ipld-prime. So maps may produce different bytes, but the decodes will still work on both ends regardless. Is there any reason that this would matter? i.e. different bytes from encode by decode compatibility between implementations for those different bytes forms. |
Sorry "byte to byte" does not need to mean "the exact same bytes". Instead, it means "roundtrip serialization / deserialization works in both directions". |
That seems much easier to reach than "exact same bytes" level of compatibility :) |
@mvdan indeed -- basically if an old client can talk to a new client, I don't care. |
Goals
#300 integrates the Graphsync 2.0 branch and passes tests.
However, it uses a pretty serious hack to make the GraphSync extension work. Graphsync extensions now MUST be a go-ipld-prime datamodel.Node. In order to make this work with data transfer messages, which are currently a go struct with cbor-gen encoding/decoding, we employ a pretty inefficient trick to coerce the data into a datamodel.Node -- we simply serialize to CBOR and deserialize using basicnode.Any.
A better strategy is to use bindnode -- this is just more work and may push on features of bindnode that are still experimental.
So, here's what is needed:
EncodeToNode(encoding.Encodable) (datamodel.Node, error)
-- and a new method for theDecoder
interface --DecodeFromNode(datamodel.Node) (encoding.Encodable, error)
Potential issues:
Sidebar improvement: We can use schema rename functionality to fix the field names in the go types -- they're arbitrarily short as cbor-gen didn't have rename functionality.
recommend collaboration with @mvdan where needed
The text was updated successfully, but these errors were encountered: