Skip to content

add concurrent waitgroup ops#7895

Merged
sstanculeanu merged 13 commits into
feat/testnet-fixesfrom
improve-concurrent-checks
Jul 8, 2026
Merged

add concurrent waitgroup ops#7895
sstanculeanu merged 13 commits into
feat/testnet-fixesfrom
improve-concurrent-checks

Conversation

@ssd04

@ssd04 ssd04 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Reasoning behind the pull request

  • Add atomic operations for managing wait group
  • Make data set in consensus atomically safer

Testing procedure

  • Standard system test

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.17073% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.68%. Comparing base (6ea7662) to head (6060488).

Files with missing lines Patch % Lines
consensus/spos/worker.go 16.66% 4 Missing and 1 partial ⚠️
consensus/spos/bls/v2/subroundBlock.go 76.92% 2 Missing and 1 partial ⚠️
consensus/spos/consensusState.go 85.71% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           feat/testnet-fixes    #7895   +/-   ##
===================================================
  Coverage               77.68%   77.68%           
===================================================
  Files                     885      885           
  Lines                  125916   125940   +24     
===================================================
+ Hits                    97812    97841   +29     
+ Misses                  21624    21617    -7     
- Partials                 6480     6482    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the SPoS consensus state API to support safer concurrent operations by adding (1) an atomic “set once” data setter and (2) a wait-group operation that applies Add() under the consensus state lock and returns the exact wait-group instance used. It then updates the BLS v2 subround block flow to use these APIs, adds tests, and introduces a panic-recovery guard in Worker.ReceivedHeader.

Changes:

  • Add SetDataIfNotSet([]byte) bool and SignaturesWaitGroupAdd(delta int) *sync.WaitGroup to the ConsensusStateHandler API and implement them in ConsensusState.
  • Update BLS v2 subroundBlock to use the new wait-group add API and to avoid overwriting consensus data if it is already set.
  • Add unit tests covering the new consensus state methods; add a recover() guard in Worker.ReceivedHeader.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
testscommon/consensus/consensusStateMock.go Extends consensus state mock with new interface methods.
consensus/spos/worker.go Adds panic recovery wrapper to Worker.ReceivedHeader.
consensus/spos/interface.go Extends ConsensusStateHandler with two new methods.
consensus/spos/consensusState.go Implements atomic data set and locked wait-group add returning the applied instance.
consensus/spos/consensusState_test.go Adds tests for SetDataIfNotSet and SignaturesWaitGroupAdd.
consensus/spos/bls/v2/subroundBlock.go Switches to new wait-group add API; avoids double-setting consensus data on received header.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread consensus/spos/worker.go
Comment thread testscommon/consensus/consensusStateMock.go Outdated
Comment thread testscommon/consensus/consensusStateMock.go
AdoAdoAdo
AdoAdoAdo previously approved these changes Jul 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment on lines +682 to 689
// SetDataIfNotSet -
func (cnsm *ConsensusStateMock) SetDataIfNotSet(data []byte) bool {
if cnsm.SetDataIfNotSetCalled != nil {
return cnsm.SetDataIfNotSetCalled(data)
}

return true
}
sstanculeanu
sstanculeanu previously approved these changes Jul 7, 2026
Comment thread consensus/spos/bls/v2/subroundBlock.go Outdated
@sstanculeanu sstanculeanu merged commit 078c37b into feat/testnet-fixes Jul 8, 2026
10 of 11 checks passed
@sstanculeanu sstanculeanu deleted the improve-concurrent-checks branch July 8, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants