-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commission is stated as percent of rewards #4243
Conversation
| let off_the_table = reward.min(Self::validators(stash).validator_payment); | ||
| let reward = reward - off_the_table; | ||
| let off_the_table = Self::validators(stash).commission * reward; | ||
| let reward = reward.saturating_sub(off_the_table); |
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.
We can't really end up with anything greater than reward, can we? Just making sure, I'm in favour of the change anyway, just to be safe.
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 don't think so since Perbill can only go up to 1, but if i didn't do it then an auditor would surely pick up on it and request the change anyway :-)
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.
Yes Perbill is between 0 and 1
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.
A nitpicky auditor would suggest to replace the multiplication above with saturating_mul as well, just in case Perbill goes over 1 🤣
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.
unfortunately Perbill doesn't implement saturating_mul with balance only saturing_mul with another Perbill hehe
|
Passes all tests locally. CI appears to be gummed up again. |
No description provided.