go-merkledag icon indicating copy to clipboard operation
go-merkledag copied to clipboard

Switch default CidBuilder to v1CidPrefix

Open lidel opened this issue 3 years ago • 2 comments

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 /v2 so 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 1 behavior)

Thoughts?

Any feedback / sanity check is appreciated.

cc @hannahhoward @hsanjuan @guseggert @whyrusleeping @willscott @Stebalien @aschmahmann

lidel avatar Apr 13 '22 19:04 lidel

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}
}

schomatis avatar May 16 '22 14:05 schomatis

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.

hsanjuan avatar May 17 '22 14:05 hsanjuan