-
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
remove the database-backed peerstore #2329
Comments
This metadata store, it surprises me a lot that it is not used enough to warrant maintaining it. Do all the consuming applications bootstrap the metadata of peers every time or do they all have their own persistence? I am using it, but the lack of iterators in the interface is quite a problem, can't count the records using it, would either have to separately and redundantly implement an index table and keep it synced or write a new implementation and extend it with a new interface that has this necessary stuff by embedding the limited base interfaces. If there is no reason relating to supporting other languages accessing the on disk database, why would there be any sense in replacing it with sqlite, when it is not optimised for a large dataset? Sqlite is an option for small data sets that is easily accessed by other languages. It would be inefficient to have it handle more than a hundred megabytes of data. |
You make some excellent points why we should remove it :) First of all, we need to ask if libp2p itself needs the metadata store? With a super easy refactor, the answer is no. |
Aside from simple peer discovery, essentially advertising keys going along with addresses, most other importers of this library are not running a gossip system to propagate network state information, as their protocol has already covered every part of that. You are correct. If people need this stuff it will be at our repository. |
I want to report another thing I discovered related to this. It stores the libp2p.Host private key in the data store, in cleartext. That also means that all libp2p apps are storing at least one excess copy of this key outside of the conusming app's own key storage. It probably should be fixed regardless of how else the rest of this works, to at least document this. I will just be aiming to make it use an encrypted Badger instance instead. We already have one in our codebase and deduplicating it was already planned. |
As far as I can tell, it's only used by drand in PLN: https://github.com/drand/drand/blob/ade43023d83b5b06f15f6563ec0e7b246b0829db/lp2p/ctor.go#L21
And by 0xmesh: https://github.com/0xProject/0x-mesh/blob/a40744bd096d2888fc16941bb940959254ea7c38/p2p/opts.go#L18
(There might be more)
The database-backed peerstore is what required #2231 and the mess we got into by adding contexts (see #2327).
It doesn't make a lot of sense to have a database-backed peerstore in the first place. The peerstore uses the disconnect event to garbage collect old entries, so there's little point in persisting this information. You'd just end up with entries that will never be evicted.
Note that this proposal is only to remove our
pstoreds
implementation of the peerstore interfaces. Users that still believe that there's value in having a database-backed peerstore are free to adopt that code: Applications can provide their own implementation of the peerstore interface in the libp2p constructor.The text was updated successfully, but these errors were encountered: