Signatory: share keysets across instances via periodic reload - #2273
Conversation
|
@cdk-bot review |
31499c1 to
6abbf4b
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2273 +/- ##
==========================================
+ Coverage 75.64% 75.82% +0.17%
==========================================
Files 369 369
Lines 89142 89594 +452
==========================================
+ Hits 67431 67931 +500
+ Misses 21711 21663 -48 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Things for last pr that should be resolved here: |
6abbf4b to
f81c207
Compare
|
@cdk-bot review |
cdk-bot
left a comment
There was a problem hiding this comment.
Verified findings approved for disclosure:
- Sub-millisecond refresh interval panics the refresh task with division by zero (low) - see inline comment
- rotate_keyset now returns Err after the rotation has already committed, leaving memory stale with no self-heal in the default config (low) - see inline comment
Unanchored locations included in summary:- crates/cdk-signatory/src/db_signatory.rs:452
- next_derivation_index ignores NULL derivation_path_index rows, so legacy keysets can cause index reuse and a silent non-rotation (low) - see inline comment
|
@cdk-bot review |
|
@cdk-bot review |
cdk-bot
left a comment
There was a problem hiding this comment.
Verified findings approved for disclosure:
- Boot can deadlock across instances: init_keysets takes per-unit advisory locks in nondeterministic HashMap order (medium) - see inline comment
Additional locations included in summary:- crates/cdk-sql-common/src/mint/keys.rs:197
|
@cdk-bot review |
ff2aff2 to
afe25c0
Compare
thesimplekid
left a comment
There was a problem hiding this comment.
One comment otherwise I think this is good
afe25c0 to
19adae0
Compare
|
@cdk-bot review |
1 similar comment
|
@cdk-bot review |
cdk-bot
left a comment
There was a problem hiding this comment.
Verified findings approved for disclosure:
- ADR-0004 references non-existent
KeysDatabase::keysets_version/keyset_versiontable; code implementskeysets_epoch/keyset_epoch(low) - see inline comment
19adae0 to
bac4a9b
Compare
|
@cdk-bot review |
cdk-bot
left a comment
There was a problem hiding this comment.
Verified findings approved for disclosure:
- Boot-time reactivation unconditionally bumps keyset_epoch even when nothing changed, causing unnecessary fleet-wide reloads (low) - Every boot of every instance in steady state bumps the persisted keyset_epoch via the unconditional add_keyset_info/set_active_keyset writes in init_keysets. Refresh-enabled peers observe the epoch mismatch and perform a full reload + snapshot republish even though no keyset was added or (de)activated. In a fleet with frequent restarts, each boot fans out redundant reloads across all peers.
Unanchored locations included in summary:- crates/cdk-sql-common/src/mint/keys.rs:110
d85e1ef to
52b0552
Compare
|
@cdk-bot review |
cdk-bot
left a comment
There was a problem hiding this comment.
Verified findings approved for disclosure:
- Cargo.lock.msrv not regenerated for new dependency edges — MSRV CI build will fail (high) - see inline comment
Additional locations included in summary:- crates/cdk-integration-tests/Cargo.toml:72
|
@cdk-bot review |
|
@thesimplekid I simplified a lot, and all reading and writing from the database happens in a transaction, serialized by the database. That is OK to simplify complexity since all operations are happening off-memory and waiting for a database |
1f2d76e to
aac24d8
Compare
|
@cdk-bot review |
05cab90 to
4c97d56
Compare
Coordinate keyset reads and rotations across processes with a global database lock and persisted epoch. Allocate derivation indexes transactionally and reload immutable in-memory snapshots on an opt-in interval. Add SQL migrations, builder and CLI configuration, concurrency regression coverage, and an ADR for the active/active design. BREAKING CHANGE: MintKeysDatabase removes autocommit keyset reads and requires epoch and transaction-scoped keyset operations.
Run the cross-instance rotation integration test in the Postgres CI job so it cannot silently pass through its missing-database guard. Update ADR wording to match the final refresh API and database-backed rotation behavior.
4c97d56 to
cc02d2d
Compare
Description
This depends on #2270
Let multiple signatories (or embedded mints) run active/active on one keys database without putting it on the signing path. The derivation index is allocated in the database under a per-unit lock and a version token gates reloads, so peers stay consistent; keys are served from an ArcSwap so a reload never blocks signing. The reload is opt-in, off by default.
See docs/adr/0004-signatory-multi-instance-sharing.md.
Notes to the reviewers
Suggested CHANGELOG Updates
CHANGED
ADDED
REMOVED
FIXED
Checklist
just quick-checkbefore committingcrates/cdk-ffi)