Skip to content

fix(provider/keystore): protect keystore size during reset#1227

Merged
guillaumemichel merged 3 commits intomasterfrom
fix/keystore-size
Feb 11, 2026
Merged

fix(provider/keystore): protect keystore size during reset#1227
guillaumemichel merged 3 commits intomasterfrom
fix/keystore-size

Conversation

@guillaumemichel
Copy link
Copy Markdown
Collaborator

Previously, if keys were added to the keystore while KeyChanFunc is called (during ResettableKeystore reset), adding keys to the alternate datastore didn't happen atomically, resulting in the same key that could be added multiple times (which isn't a problem in itself), leading to a wrong keystore size increase.

Added a mutex to protect the alternate datastore from concurrent writes during reset, to keep a correct keystore size.

The keystore size corresponds to the number of CIDs scheduled in ipfs provide stat.

Also added logging to flag ResettableKeystore reset events.

Copy link
Copy Markdown
Contributor

@gammazero gammazero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one question

@guillaumemichel guillaumemichel merged commit 4ea2e7d into master Feb 11, 2026
9 checks passed
@guillaumemichel guillaumemichel deleted the fix/keystore-size branch February 11, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants