-
Notifications
You must be signed in to change notification settings - Fork 1
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
return 0 for getDelegateRewards if voter didn't vote in the screening stage #132
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this check be done inside _getDelegateReward
function so to be applied for all scenarios where it is called?
@@ -1099,6 +1099,8 @@ contract GrantFund is IGrantFund, Storage, ReentrancyGuard { | |||
DistributionPeriod storage currentDistribution = _distributions[distributionId_]; | |||
VoterInfo storage voter = _voterInfo[distributionId_][voter_]; | |||
|
|||
if (voter.screeningVotesCast == 0) return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer using
if (voter.screeningVotesCast != 0) {
rewards_ =
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I'm not opinionated about this change, it's a pattern we have been following in the contracts repo and therefore I agree with @grandizzy .
Did it this way for a couple of reasons - this would be the minimal amount of changes, and also, the claim approach should revert instead of returning 0, so we would have to create branching logic to handle claim vs get calls to |
makes sense, thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description of change
High level
getDelegateRewards
if voter didn't vote in the screening stageDescription of bug or vulnerability and solution
getDelegateReward
returned incorrect values if called when a voter didn't vote in the screening stage.