You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we receive a PUT_VALUE RPC from a remote peer, the key will contain a namespace prefix (e.g., pk or ipns) followed by a binary key. In the case of IPNS the key follows the spec:
Key format:/ipns/BINARY_ID
This is in line with how the IPNS key gets generated here:
func (nName) RoutingKey() []byte {
varbuffer bytes.Bufferbuffer.WriteString(NamespacePrefix)
buffer.Write(n.src) // Note: we append raw multihash bytes (no multibase)returnbuffer.Bytes()
}
NamespacePrefix is set to /ipns/. In the handlePutValue method the key parameter will be set to the above /ipns/BINARY_ID format. Later in that handler we're generating the datastore key via convertToDsKey(rec.GetKey()):
This means we're taking the bytes of the string /ipns/BINARY_ID and encode them as base32. This means we're losing the capability of proper namespacing. The /ipns prefix will still be the same in base32 for all keys but still this seems like a coincidence. In the ProviderManager, we're properly encoding each component separately here.
Changing this key format will be incompatible with any persistent stores out there. We'd need to support both types of keys (everything base32 encoded and only BINARY_ID encoded) for some time.
With go-libp2p-kad-dht v2 we could take the liberty to introduce a breaking change here.
The text was updated successfully, but these errors were encountered:
(Migrated from libp2p/go-libp2p-kad-dht#869)
When we receive a
PUT_VALUE
RPC from a remote peer, the key will contain a namespace prefix (e.g.,pk
oripns
) followed by a binary key. In the case of IPNS the key follows the spec:This is in line with how the IPNS key gets generated here:
NamespacePrefix
is set to/ipns/
. In thehandlePutValue
method the key parameter will be set to the above/ipns/BINARY_ID
format. Later in that handler we're generating the datastore key viaconvertToDsKey(rec.GetKey())
:This means we're taking the bytes of the string
/ipns/BINARY_ID
and encode them as base32. This means we're losing the capability of proper namespacing. The/ipns
prefix will still be the same in base32 for all keys but still this seems like a coincidence. In theProviderManager
, we're properly encoding each component separately here.Changing this key format will be incompatible with any persistent stores out there. We'd need to support both types of keys (everything base32 encoded and only BINARY_ID encoded) for some time.
With go-libp2p-kad-dht v2 we could take the liberty to introduce a breaking change here.
The text was updated successfully, but these errors were encountered: