Switch default CidBuilder to v1CidPrefix
Part of https://github.com/ipfs/ipfs/issues/337, initially proposed in https://github.com/ipfs/go-ipfs/issues/4143#issuecomment-1098100146
Switching to v1CidPrefix in CidBuilder() sounds like a good way to ensure the ecosystem moves to CIDv1 (https://github.com/ipfs/go-merkledag/network/dependents )
How to handle BREAKING CHANGE?
Switch to CIDv1 will produce different multihashes in DAGs, which is a breaking change. I assume we want to do this, so the question is how to do it safely, and what other breaking changes we want to make.
Initial ideas:
- release CIDv1 version as
/v2so nobody is surprised by different CIDs and DAGs- since we make a breaking one, also produce raw-leaves, if not enabled yet (matching
ipfs add --cid-version 1behavior)
- since we make a breaking one, also produce raw-leaves, if not enabled yet (matching
Thoughts?
Any feedback / sanity check is appreciated.
cc @hannahhoward @hsanjuan @guseggert @whyrusleeping @willscott @Stebalien @aschmahmann
Maybe related: we already silently upgrade from v0 to v1 when using a non-protobuf codec:
func (p V0Builder) WithCodec(c uint64) Builder {
if c == DagProtobuf {
return p
}
return V1Builder{Codec: c, MhType: mh.SHA2_256}
}
Meh, seems low risk to me...
Assuming I have a Protonode, either:
- I just built it, therefore I may just want the CID whatever it is.
- I obtained it from somewhere, therefore I probably already have the working CID for it.
Given all the changelog warnings, the /v2 etc... I think it is reasonable to move forward.