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

add check of rosterLen before sending dkg request #223

Conversation

chenchanglew
Copy link
Contributor

Before defines every addrs array in services, we check the rosterLen is not empty to have an early return

@chenchanglew chenchanglew requested a review from a team as a code owner November 23, 2022 19:27
@chenchanglew chenchanglew linked an issue Nov 23, 2022 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Nov 23, 2022

Pull Request Test Coverage Report for Build 3535095716

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 4 of 8 (50.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.05%) to 56.774%

Changes Missing Coverage Covered Lines Changed/Added Lines %
services/dkg/pedersen/mod.go 4 8 50.0%
Files with Coverage Reduction New Missed Lines %
services/dkg/pedersen/mod.go 2 84.75%
Totals Coverage Status
Change from base Build 3532352957: -0.05%
Covered Lines: 3273
Relevant Lines: 5765

💛 - Coveralls

@chenchanglew chenchanglew force-pushed the 216-technical-debt-check-lendaddrs-before-sending-getpeerkey branch from 67577d2 to 06d20e9 Compare November 23, 2022 19:34
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

50.0% 50.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@emduc emduc left a comment

Choose a reason for hiding this comment

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

Nice small optimization :)

Comment on lines +373 to +375
if players.Len() == 0 {
return xerrors.Errorf("the list of Participants is empty")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

should we call a.setErr here ?
This function is called when we want to decrypt the ballots, so I am wondering what we would be able to do / should do in the scenario where players is empty...

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, true.
@Flamewind97 please add a setErr as in other cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the end we don't need, I mixed the context.

Comment on lines +373 to +375
if players.Len() == 0 {
return xerrors.Errorf("the list of Participants is empty")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

yes, true.
@Flamewind97 please add a setErr as in other cases.

@nkcr nkcr self-requested a review December 15, 2022 14:12
Comment on lines +373 to +375
if players.Len() == 0 {
return xerrors.Errorf("the list of Participants is empty")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In the end we don't need, I mixed the context.

@chenchanglew chenchanglew merged commit 39a2d33 into main Dec 15, 2022
@chenchanglew chenchanglew deleted the 216-technical-debt-check-lendaddrs-before-sending-getpeerkey branch December 15, 2022 14:17
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.

Technical Debt - check lenAddrs before sending getPeerKey
4 participants