fix(peerstore): load persisted keypairs on peerstore restore#1331
Open
bhuvan-somisetty wants to merge 9 commits into
Open
fix(peerstore): load persisted keypairs on peerstore restore#1331bhuvan-somisetty wants to merge 9 commits into
bhuvan-somisetty wants to merge 9 commits into
Conversation
Added a new issue template for the DMP 2026 project, including fields for project description, goals, setup, expected outcomes, acceptance criteria, implementation details, mockups, product name, organization name, governance domain, technical skills required, mentors, and categories.
Signed-off-by: bhuvan-somisetty <somisettybhuvan5@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keypairs were being serialized and saved to the datastore correctly, but the deserialization path on restore was completely bypassed. Both the sync and async implementations had the loading code commented out with a
passplaceholder and a TODO note, meaning every time a node restarted and the peerstore was rehydrated from SQLite, the peer's public and private keys would silently disappear. Addresses, metadata, and protocols came back fine, but keys did not.This is a direct blocker for #312. A persistent peerstore that drops keypairs on restart can't actually provide persistent node identity, which is the whole point.
The fix calls
deserialize_public_keyanddeserialize_private_key(already present inlibp2p.crypto.serialization) when loading key data from the datastore. The serialization side was already correct; only the load path was missing. Both the syncSyncPersistentPeerStoreand asyncAsyncPersistentPeerStoreare updated symmetrically.Three tests cover the new behavior: SQLite round-trip for sync, SQLite round-trip for async, and a sanity check that the memory backend correctly does not persist across instances.