Skip to content
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

Pseudo slashing fixes #4630

Merged
merged 5 commits into from Oct 24, 2022
Merged

Conversation

ssd04
Copy link
Contributor

@ssd04 ssd04 commented Oct 24, 2022

Reasoning behind the pull request

  • Error on creating the aggregated signature on leader was not treated accordingly. Since the sig share is not checked by each node separately, it can happen that an invalid format sig share is provided, so signature aggregation will fail

Proposed changes

  • handler invalid signers similar as in the verification case

Testing procedure

  • N/A

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 Oct 24, 2022
@ssd04 ssd04 marked this pull request as ready for review October 24, 2022 09:56
@AdoAdoAdo AdoAdoAdo self-requested a review October 24, 2022 10:00
@codecov-commenter
Copy link

codecov-commenter commented Oct 24, 2022

Codecov Report

❗ No coverage uploaded for pull request base (feat/optimise-consensus-sigcheck@91440ea). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@                         Coverage Diff                         @@
##             feat/optimise-consensus-sigcheck    #4630   +/-   ##
===================================================================
  Coverage                                    ?   71.23%           
===================================================================
  Files                                       ?      664           
  Lines                                       ?    86296           
  Branches                                    ?        0           
===================================================================
  Hits                                        ?    61474           
  Misses                                      ?    20305           
  Partials                                    ?     4517           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -302,39 +302,28 @@ func (sr *subroundEndRound) doEndRoundJobByLeader() bool {
sig, err := sr.SignatureHandler().AggregateSigs(bitmap, sr.Header.GetEpoch())
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can extract L301-L328 in a separate method which will return bitmap, sig and err, actually you can directly return from there sr.handleInvalidSignersOnAggSigFail(), and make the code easier to read there without so much if else levels. Here you should have only something like this:

bitmap, sig, err := sr.aggregateSigsAndHandleInvalidSigners(bitmap)
if err != nil {
	log.Debug("doEndRoundJobByLeader.aggregateSigsAndHandleInvalidSigners", "error", err.Error())
	return false
}

func (sr *subroundEndRound) handleInvalidSignersOnAggSigFail() ([]byte, []byte, error) {
invalidPubKeys, err := sr.verifyNodesOnAggSigFail()
if err != nil {
log.Debug("doEndRoundJobByLeader.verifyNodesOnAggSigVerificationFail", "error", err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

.verifyNodesOnAggSigFail

Copy link
Contributor

@AdoAdoAdo AdoAdoAdo left a comment

Choose a reason for hiding this comment

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

no additional comments

@ssd04 ssd04 merged commit 5b948bb into feat/optimise-consensus-sigcheck Oct 24, 2022
@ssd04 ssd04 deleted the pseudo-slashing-fixes branch October 24, 2022 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants