Skip to content

optimistic sig share creation for managed keys#7831

Open
ssd04 wants to merge 8 commits intofeat/testnet-fixesfrom
optimistic-sig-share-creation
Open

optimistic sig share creation for managed keys#7831
ssd04 wants to merge 8 commits intofeat/testnet-fixesfrom
optimistic-sig-share-creation

Conversation

@ssd04
Copy link
Copy Markdown
Contributor

@ssd04 ssd04 commented Apr 15, 2026

Reasoning behind the pull request

  • In case there is a competing block and we have to wait until we send the signatures for the next round, we should trigger signature shares creation optimistically

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?

@ssd04 ssd04 self-assigned this Apr 15, 2026
return false
}

func (sr *subroundSignature) createSignaturesForManagedKeys(ctx context.Context) bool {
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.

this pre-checks here are very similar with doSignatureJobForManagedKeys but i would keep it like this for simplicity

sr.GetHeader().GetEpoch(),
pkBytes,
)
signatureShare, err := sr.SigningHandler().SignatureShare(uint16(idx))
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.

in each start subround, there is a Reset for all consensus state, including SigningHandler, there should't be any index collision with the signatures from the previous round; the wait time is related to the proof arrival, not with the signatures

}
}

// Wait once for the entire node if competing block detected
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shouldn't L125-128 be inside the previous if? they basically do similar loops as waitForCompetingBlockEarlyChecks

Copy link
Copy Markdown
Contributor Author

@ssd04 ssd04 Apr 15, 2026

Choose a reason for hiding this comment

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

here there is also the check for single key, will check how to integrate them better

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.

refactored to include them in the same condition branch

sr.signatureThrottler.StartProcessing()
wg.Add(1)

go func(ctx context.Context, idx int, pk string) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this starts a goroutine, but does not handle the context, so goroutines may be hanging if the process stops

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.

added context check in goroutine

if err != nil {
log.Debug("sendSignatureForManagedKey.CreateSignatureShareForPublicKey", "error", err.Error())
return false
// signature share not found (optimistic signature share creation was not triggered)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what if failure reason was different?

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.

i think we should try to create the signature share (if not already created) whatever the reason; before we tried to create it directly each time, now there is additional check

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.

2 participants