feat(validator): use manual transaction encryption key rotation - #2382
Conversation
juan518munoz
left a comment
There was a problem hiding this comment.
Looks good, thanks! Left some minor comments.
| three keys. | ||
|
|
||
| Production deployments should not pass the secret in plaintext. Instead, wrap it with a symmetric AWS KMS key | ||
| At a rotation boundary, all validators must restart with the same schedule. For example, a restart that activates key B |
There was a problem hiding this comment.
nit: I think "must restart at a rotation boundary" can be a bit ambiguous here - I'd say that the restarts must happen when changing the configured keys, and that keys automatically activate at epoch boundaries
There was a problem hiding this comment.
Reworded. Restarts happen when the configured keys change; activation happens at epoch boundaries
| let chain_tip = *self.committed_tip.borrow(); | ||
| let epoch = chain_tip.block_epoch(); |
There was a problem hiding this comment.
Is there a race from reading this snapshot outside the loop? By the time the mutex gets acquired another request could move the cache to the new attestation (then for the first request, cached.attested.epoch == epoch would fail and the cache would get rolled back).
If this could even happen it still seems like it would be a very low impact (if any) problem, as it would fail for a single request at most.
There was a problem hiding this comment.
Yes, this race was possible. The tip is now read under the cache lock, with a regression test for this ordering
a55f6fa
into
jmunoz-tx-encryption-key-rotation
Changes transaction encryption key rotation from automatic to manual. Operators configure a previous key, a current key, and an optional next key when each validator starts. Keys activate only at epoch boundaries, which supports repeated planned rotations with a one-epoch grace period.
Schedule refreshes share one task, have fixed timeouts, and back off after errors or panics w/o treating cancellation as failure.