-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Remove stale validator keys during reload #1054
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just the one comment below
signing/src/main/java/tech/pegasys/web3signer/signing/config/DefaultArtifactSignerProvider.java
Outdated
Show resolved
Hide resolved
final Map<String, ArtifactSigner> oldSigners = new HashMap<>(signers); | ||
// step 2: Clear current signers and then load them via ArtifactSignerCollectionSupplier | ||
if (!reloadKeepStaleKeys) { | ||
signers.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this clear means there will be no signers loaded and will possibly fail some signing requests for keys aren't going to be unloaded. Can this be done without clearing the existing signers and just applying the delta to add and remove entries from the existing signer's map?
jdbi.useTransaction( | ||
handle -> { | ||
// disable the validators in the database | ||
staleValidators.forEach( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are the stale validators disabled after removing from the signers map? This will affect all web3signer instances using the same database. The validator is already removed from the signers map so don't see why disabling them is necessary.
…ng logic to avoid clearing the map. Also made sure maps are thread-safe by using concurrent maps
PR Description
Remove stale validator keys during reload API call. The stale keys will not be listed in public keys API call after reload. They are also disabled in slashing database in eth2 mode.
Due to this PR, the behavior of reload API endpoint has been modified. It will remove all in-memory keys before loading them again using configuration files and bulk loading. This unfortunately results in behaviour change of local configuration files pointing to encrypted keystores. Previously cached local configuration files were avoided being reloaded during reload API call, now they will be reloaded and reparsed. To keep the old behavior
--reload-keep-stale-keys=true
option can be used which will not remove stale keys during reload API call.Fixed Issue(s)
Fixes #1018
Documentation
doc-change-required
label to this PR if updates are required.Changelog
Testing