fix: prevent deadlock in attestation signature aggregation#574
Merged
ch4r10t33r merged 1 commit intomainfrom Feb 13, 2026
Merged
fix: prevent deadlock in attestation signature aggregation#574ch4r10t33r merged 1 commit intomainfrom
ch4r10t33r merged 1 commit intomainfrom
Conversation
g11tech
approved these changes
Feb 13, 2026
Comment on lines
339
to
+348
| @@ -343,6 +345,7 @@ pub const BeamChain = struct { | |||
| &self.forkChoice.aggregated_payloads, | |||
| ); | |||
| _ = building_timer.observe(); | |||
| self.forkChoice.signatures_mutex.unlock(); | |||
Collaborator
There was a problem hiding this comment.
It's okay now that we have merged it but I find scoping it better design
{
self.forkChoice.signatures_mutex.lock();
defer self.forkChoice.signatures_mutex.unlock();
const building_timer = zeam_metrics.lean_pq_sig_attestation_signatures_building_time_seconds.start();
try aggregation.computeAggregatedSignatures(
attestations,
&self.forkChoice.aggregated_payloads,
);
_ = building_timer.observe();
}
I think the defer would be called as soon as the code section ends
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a potential deadlock in attestation signature aggregation by reducing the scope of the
signatures_mutexlock.Problem
The previous implementation held
signatures_mutexacrossonBlockandupdateHeadcalls, which could cause a deadlock:signatures_mutex→forkChoice.mutexforkChoice.mutex→signatures_mutexSolution
Lock
signatures_mutexonly for the duration ofcomputeAggregatedSignatures, then immediately unlock before callingonBlock/updateHead.Changes
signatures_mutex.unlock()to immediately aftercomputeAggregatedSignaturesdeferto make lock scope explicitTest Plan