Skip to content

Commit 5db6d09

Browse files
[ci] two-steps keys rotation (trial)
Signed-off-by: Julien Tinguely <[email protected]>
1 parent f8e75e9 commit 5db6d09

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

apps/common/src/main/scala/org/lfdecentralizedtrust/splice/setup/NodeInitializer.scala

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ class NodeInitializer(
374374
} yield ()
375375
}
376376

377+
// Note: this needs to be done in two steps (one to add and one to remove the keys) in order to avoid warnings in the log
377378
private def performKeyRotation(
378379
ownerToKeyMappings: Seq[StoredTopologyTransaction[TopologyChangeOp, TopologyMapping]],
379380
member: Member,
@@ -406,7 +407,7 @@ class NodeInitializer(
406407
)
407408
case key => Future.successful(key)
408409
}
409-
newKeysNE <- NonEmpty.from(newKeys) match {
410+
newKeysNE1 <- NonEmpty.from((newKeys ++ currentKeys).distinct) match {
410411
case Some(ne) => Future.successful(ne)
411412
case None =>
412413
Future.failed(
@@ -415,7 +416,19 @@ class NodeInitializer(
415416
}
416417
_ <- connection.ensureOwnerToKeyMapping(
417418
member = member,
418-
keys = newKeysNE,
419+
keys = newKeysNE1,
420+
retryFor = RetryFor.Automation,
421+
)
422+
newKeysNE2 <- NonEmpty.from(newKeys) match {
423+
case Some(ne) => Future.successful(ne)
424+
case None =>
425+
Future.failed(
426+
new IllegalStateException("newKeys collection cannot be empty after rotation.")
427+
)
428+
}
429+
_ <- connection.ensureOwnerToKeyMapping(
430+
member = member,
431+
keys = newKeysNE2,
419432
retryFor = RetryFor.Automation,
420433
)
421434
} yield logger.info(
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Errors and warnings caused by the key rotation in ManualSignatureIntegrationTest
2-
.*could not verify client's signature.*
3-
.*used to generate signature is not a valid key.*
4-
.*Response message for request.* timed out.*
5-
.*Now retrying operation 'request current time'.*
2+
#.*could not verify client's signature.*
3+
#.*used to generate signature is not a valid key.*
4+
#.*Response message for request.* timed out.*
5+
#.*Now retrying operation 'request current time'.*
66

0 commit comments

Comments
 (0)