-
Notifications
You must be signed in to change notification settings - Fork 30
[DO NOT MERGE] poc: allow pure V2 records #42
Conversation
This is part of deprecation described in ipfs/kubo#9240 - record creation continues to create both V1 and V2 signatures - record validation no longer accepts V1 signatures Meaning: - modern nodes are 100% V2, they ignore V1 signatures - legacy nodes (go-ipfs < v0.9.0) are still able to resolve names created by go-ipns, because V1 is still present
This is a PoC that shows minimal set of changes to allow "pure V2" IPNS records which have only two protobuf fields: `IpnsEntry.Data` and `IpnsEntry.SignatureV2` `Create` still creates V1+V2, but the `Validate` only cares about V2 fields.
Agreed, we cannot really allow pure v2 records without either doing some hacky/difficult to reason about things or resolving the TODO around switching to passing around IPNS record objects that are not tied to the protobuf itself Lines 143 to 145 in 1df1d60
The refactor here is kind of painful and is a breaking change. Doing this seems generally helpful anyway to help with:
I wonder if it would be reasonable to start here by making a new struct (or interface) That being said it's a pile of work to save us some bytes and complexity. It'd be nice to do it sooner than later since ecosystem changes to deprecate protocols like this take time, however there's lots of other important work to do even in the IPNS space itself so totally put the time wherever seems appropriate. Mostly flagging the above so the issue is known and can be tracked here and in the specs PR. |
I've been thinking about practical ramifications of this PR, and I am concerned about breaking legacy consumer nodes. If there is software that uses IPNS for fetching updates, and the IPNS publisher node suddenly switches to pure V2 CBOR, legacy clients will not be able to validate these records and will be stuck on old version. Pulling the rug like that is not good. I'd argue using IPNS for signaling updates is its main purpose. I agree we should refactor this library, create
I've added "TODO" to this PR and "backward compatibility" policy section to the spec PR: ipfs/specs#319 (comment) (ipfs/specs@b926e8c) to ensure we don't break systems that use IPNS for signaling updates. |
Makes it more clear when we require CBOR to match protobuf
Tracked in ipfs/specs#376. |
This PR
This is a PoC that shows minimal set of changes to pass
Validate
check when "pure V2" IPNS records which have only two protobuf fields:IpnsEntry.Data
andIpnsEntry.SignatureV2
Create
still creates V1+V2 for backward-compatibilityValidate
only cares about V2 fields (IpnsEntry.Data
andIpnsEntry.SignatureV2
) and nothing more.Why?
Right now "V1+V2" in-between is required for successful validation: even tho SignatureV1 is not used, and we only check SignatureV2, some fields must have the same value in
IpnsEntry
protobuf AND dag-cbor inIpnsEntry.Data
If we ever want to fully ditch legacy of V1, we would have to start with removing the requirement of duplicated fields, allowing lean records.
Discovered Problems 💢
https://github.com/ipfs/go-namesys/blob/1bf7d3d9cbe8f988b232b92288b24d25add85a00/routing.go#L118-L133
Same for JS side of things.
data
again.IpnsEntry
(protobuf) andIpnsEntry.data
(dag-cbor) most likely everything that usesIpnsEntry
will effectively break.IpnsEntry
protobuf. This needs to be replaced with higher level IpnsRecord API.Way forward may exist, but will take significant effort
I don't think this can be done half-way. Will end up in hacky code, leaky abstractions and be very error prone.
If we want to support pure V2, then we need to introduce new protobuf with only
data
andsignature
(V2) fields and refactor all involved libraries, in both GO and JS. Instead of returning protobuf object, we should have IpnsRecord struct with funcs that provide easy access to DAG-CBOR fields.This is significant effort which I don't have bandwidth to do atm, so parking this as a draft for now. #41 must be enough for now.
I will document the situation in ipfs/specs#319 so someone else will be able to pick this up with better clarity.
TODO
IpnsRecord
abstraction that hides V1 and V2 detailsCreate
produces V1+V2 by default (so we don't break legacy consumers)Validate
requires presence of V1 fields presence only ifsignatureV1
is present, and fails whensignatureV1
is missing, butvalue
is present in protobuf – this ensures we move towards DAG-CBOR-only future.data
andsignatureV2
fields)