-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
signed peer records: make them actually usable #2304
Comments
Metadata might not give us the properties we're looking for, we need to be able to atomically update the metadata iff we receive a new record with a higher sequence number. This has be atomic since there will be multiple places from which such updates will happen (e.g. Identify, Kademlia, etc.). Possible API: type CertifiedAddrBook interface {
MaybeAddCertifiedRecord(p peer.ID, seq uint64, envelope []byte) (updated ok) // we only update when the sequence number is higher than what we're currently storing
GetCertifiedRecord(p peer.ID) []byte // nil if we don't have one
} |
Can we move the address handling logic out and keep the peer record api as
|
Related proposal to fully embrace signed peer records: libp2p/specs#552 |
To be able to retrieve signed peer records, we need to store the serialized format, thanks to their non-deterministic serialization.
We also need to store the contents in the peer store, if we actually want to use the contents.
The current peer store API makes using signed peer records very cumbersome:
go-libp2p/core/peerstore/peerstore.go
Lines 123 to 181 in 5a0411b
Most importantly, it doesn't allow us to filter addresses, it's all or nothing. This is a problem for #2300, and will be for Kademlia, once it adds support for signed peer records (see libp2p/go-libp2p-kad-dht#839).
In identify, we currently accept any signed peer record the peer sends us, without even checking that it's the peer's signed peer record (any correctly signed record will be accepted).
What we should do instead is the following:
CertifiedAddrBook
interface.AddAddrs
API to add save the addresses contained in the signed peer record.The text was updated successfully, but these errors were encountered: