Open hannahhoward opened 3 years ago
Very nice. Is this going to be a breaking change, or an optional upgrade? I can't figure out if/how graphsync might do versioning but would it be a "can you talk v1.1.0? great, here's my DAG-CBOR messages"?
The map representation question might come down to how important shaving bytes off these messages is. It's nice having self-describing data, but it does introduce quite a bit of overhead to have the keys in there too.
If I take GraphSyncRequest
and encode a simple form using this spec then it takes up 99 bytes. If I rename
the keys down to single characters then it goes down to 62 bytes. As a tuple
representation it's 48 bytes.
The problems with tuple
representations:
optional
elements (although I think we may end up allowing for the trailing element to be optional), which you could do in this current form if it made senseSo, not strong reasons to avoid tuple
, but I think you're in the best position to suggest what might be best for graphsync.
We also typically give fields lowercase
or mixedCase
names.
(When you feed this into codegen in golang, it's going to generate accessor methods with appropriate export case.)
Syntax nittery aside, this logically LGTM :D
Re: lowercase names -- FYI, this is the opposite of cbor-gen, though I guess I could use the rename facility to handle this. Actually, usually cbor-gen uses tuple representation so naming is irrelevant. Unfortunately, when using map representation it does not allow renames. I have a PR to do this but it remains unmerged. (https://github.com/whyrusleeping/cbor-gen/pull/46)
Sorry to keep referencing cbor-gen -- but if go-ipld-prime is to get merged through the filecoin ecosystem (which is my hope eventually) , these two will need to move toward compatibility.
@rvagg yes the intent is to support both v1.0.0 and v1.1.0 for a time -- protocol negotiation is done at the libp2p level - the protocol name is already versioned, so we simply add a fallback if 1.1.0 doesn't work. We do this in Bitswap and several other protocols.
@rvagg & @warpfork I believe I've addressed the comments:
go-graphsync
before we merge it, to get some real world testing (though that may end up being a bit)What's still needed to advance this? At last read, both this and https://github.com/ipld/specs/pull/355 (I assume that's the other follow-up PR you mentioned) look reasonable to me.
If this is pending an implementation, and we don't expect that to happen presently, should we... perhaps merge both these PRs, but then also relocate the file and give it a header to mark it explicitly as a future-oriented draft? (I'm happy to do the git-fu and commenting on that, if that's the path forward.)
Ping for if we can merge this :)
Goals
Move graphsync to a CBOR based protocol instead of one based on protobuf
Implementation
Graphsync messages should be valid IPLD data structures encoded in DAG-CBOR. I have constructed an IPLD schema to represent what they should look like.
I've also promoted Metadata out of an extension to a core part of the response message as opposed to an extension -- this is a frequent design issue with v1.0.0.
For Discussion
This is a first stab and I have many questions: