Skip to content

Time left checks + cleanup#7892

Merged
AdoAdoAdo merged 5 commits into
feat/testnet-fixesfrom
signature-time-checks
Jul 2, 2026
Merged

Time left checks + cleanup#7892
AdoAdoAdo merged 5 commits into
feat/testnet-fixesfrom
signature-time-checks

Conversation

@ssd04

@ssd04 ssd04 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Reasoning behind the pull request

Proposed changes

Testing procedure

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 Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 30.43478% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.68%. Comparing base (468c3ce) to head (dd67d4a).
⚠️ Report is 6 commits behind head on feat/testnet-fixes.

Files with missing lines Patch % Lines
consensus/spos/bls/v2/subroundSignature.go 30.00% 11 Missing and 3 partials ⚠️
consensus/spos/bls/v2/subroundEndRound.go 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           feat/testnet-fixes    #7892      +/-   ##
======================================================
- Coverage               77.69%   77.68%   -0.02%     
======================================================
  Files                     885      885              
  Lines                  125797   125790       -7     
======================================================
- Hits                    97742    97715      -27     
- Misses                  21585    21594       +9     
- Partials                 6470     6481      +11     

☔ 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.

sstanculeanu
sstanculeanu previously approved these changes Jul 1, 2026
}

func (sr *subroundSignature) isTimeLeft() bool {
timeLeft := sr.RoundHandler().RemainingTime(sr.RoundHandler().TimeStamp(), time.Duration(sr.EndTime()))

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.

This uses sr.EndTime() of the subround signature. In the specs, there is a new const, signatureSendDeadline which is used in this case which is < sr.EndTime().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the signature subround was already reduced with the new changes in subrounds config, i think that's not very applicable anymore; but tbd after we complete and fine tune all the parts

defer cancel()

sr.waitForSingatures(timeLeft)
isTimeLeft := sr.waitForSignatures(timeLeft)

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.

If not all sigs are done, this will return false. Isn't there a way to use only the signatures that are done instead of ignoring all? What is the downside of doing that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

if timeout here, it means there is no time for sending any signature, so the signatures that were already created will not be useful anyway

return false
}

signatureShare, err := sr.SigningHandler().CreateSignatureShareForPublicKey(

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.

Will there be any advantage if we also optimistically sign for the singleKey node instead of creating the signature here? Or is it cheap enough to not matter for a single key?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the initial intend was for multi-key nodes; yea, i don't think it's worth adding more complexity for a single key node

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 tightens timeout handling in the BLS v2 SPoS signature flow and performs related cleanup in both implementation and tests.

Changes:

  • Add explicit “time left” guards in signature-job execution paths and propagate wait results from the optimistic-signature wait logic.
  • Simplify competing-block waiting by removing the node-level helper and updating tests/exports accordingly.
  • Clean up tests by removing a retry-until-context-cancelled scenario and unused imports.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
consensus/spos/bls/v2/subroundSignature.go Adds time-left checks, refactors signature waiting to return a status, and removes managed-key fallback signature creation.
consensus/spos/bls/v2/subroundEndRound.go Adds a remaining-time guard to stop processing signatures after the end-round signature wait window.
consensus/spos/bls/v2/subroundSignatureCompetingBlock_test.go Updates tests to call WaitIfCompetingBlock instead of the removed node-level helper.
consensus/spos/bls/v2/subroundSignature_test.go Removes a test that depended on the removed “retry create signature share” behavior and drops unused atomic import.
consensus/spos/bls/v2/export_test.go Removes the exported test helper WaitIfCompetingBlockForNode.

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

Comment thread consensus/spos/bls/v2/subroundSignature.go Outdated
Comment thread consensus/spos/bls/v2/subroundSignature.go
Comment on lines +991 to +994
remainingTime := sr.remainingTime()
if remainingTime <= 0 {
return false
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

moved below

Comment on lines +386 to 387
result := sr.WaitIfCompetingBlock(context.Background(), []byte{}, 100, []byte("current_hash"))
assert.False(t, result, "should return false when no key has a competing block")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

renamed

@AdoAdoAdo AdoAdoAdo merged commit 05bbb23 into feat/testnet-fixes Jul 2, 2026
9 of 11 checks passed
@AdoAdoAdo AdoAdoAdo deleted the signature-time-checks branch July 2, 2026 14:14
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.

5 participants