-
Notifications
You must be signed in to change notification settings - Fork 780
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
[Merged by Bors] - Allow truncation of pubkey cache on creation #1686
Conversation
Marking this WIP while we work out a fix for this case raised by @paulhauner:
|
@paulhauner I think the case mentioned above is actually OK, because the beacon chain won't even try to re-initialise the cache if the head exists and it's missing. I tested deleting the pubkey cache and this error occurs:
My change is only relevant in the case where lighthouse/beacon_node/beacon_chain/src/builder.rs Lines 532 to 535 in a1a6b01
And it only happens if lighthouse/beacon_node/beacon_chain/src/builder.rs Lines 316 to 324 in a1a6b01
|
a327468
to
193e822
Compare
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.
@paulhauner I think the case mentioned above is actually OK
Nice, sorry for the distraction.
Merge it!
No problemo~ bors r+ |
## Issue Addressed Closes #1680 ## Proposed Changes This PR fixes a race condition in beacon node start-up whereby the pubkey cache could be created by the beacon chain builder before the `PersistedBeaconChain` was stored to disk. When the node restarted, it would find the persisted chain missing, and attempt to start from scratch, creating a new pubkey cache in the process. This call to `ValidatorPubkeyCache::new` would fail if the file already existed (which it did). I changed the behaviour so that pubkey cache initialization now doesn't care whether there's a file already in existence (it's only a cache after all). Instead it will truncate and recreate the file in the race scenario described.
Pull request successfully merged into master. Build succeeded: |
Issue Addressed
Closes #1680
Proposed Changes
This PR fixes a race condition in beacon node start-up whereby the pubkey cache could be created by the beacon chain builder before the
PersistedBeaconChain
was stored to disk. When the node restarted, it would find the persisted chain missing, and attempt to start from scratch, creating a new pubkey cache in the process. This call toValidatorPubkeyCache::new
would fail if the file already existed (which it did). I changed the behaviour so that pubkey cache initialization now doesn't care whether there's a file already in existence (it's only a cache after all). Instead it will truncate and recreate the file in the race scenario described.