feat(mint): introduce automatic keyset rotations#1058
Open
a1denvalu3 wants to merge 6 commits into
Open
Conversation
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
KvngMikey
reviewed
Jun 22, 2026
KvngMikey
approved these changes
Jun 22, 2026
KvngMikey
left a comment
Collaborator
There was a problem hiding this comment.
just the nit, otherwise lgtm!
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.
This PR introduces automatic keyset rotations for Nutshell to encourage/force operators to rotate keysets regularly, as operators rarely perform them manually.
What's Changed
MINT_KEYSET_ROTATION_ENABLED(default:True) andMINT_KEYSET_ROTATION_INTERVAL_SECONDS(default: 30 days) tocashu/core/settings.pyand documented them in.env.example.should_rotate_keysetto safely calculate the age of active keysets (handling both sqlite and postgres timestamp differences).rotate_keysets_if_neededto automatically rotate active keysets for all configured units when they exceed the interval, while preserving customized fees, orders, and final expiry.store_keysetin DB CRUD to update thevalid_from,valid_to, andfirst_seentimestamps on the in-memory keyset object on creation, ensuring memory and DB stay in perfect synchronization._startup_keysets)._run_regular_tasks).README.md.MINT_DERIVATION_PATHin.envafter a rotation.tests/mint/test_mint_automatic_rotations.pycovering standard rotation, disabled mode, and parameter preservation.Passed
ruff checkandmypywithout any errors.