Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@gavofyork
Copy link
Member

No description provided.

@gavofyork gavofyork added the A0-please_review Pull request needs code review. label Nov 28, 2019
@gavofyork gavofyork added this to the 2.0 milestone Nov 28, 2019
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);
Copy link
Contributor

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.

Copy link
Member Author

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 :-)

Copy link
Contributor

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

Copy link
Contributor

@tomusdrw tomusdrw Nov 28, 2019

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 🤣

Copy link
Contributor

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

@gavofyork
Copy link
Member Author

Passes all tests locally. CI appears to be gummed up again.

@gavofyork gavofyork merged commit d9fca7e into master Nov 28, 2019
@gavofyork gavofyork deleted the gav-percentage-commission branch November 28, 2019 14:45
nodebreaker0-0 pushed a commit to nodebreaker0-0/substrate that referenced this pull request Nov 29, 2019
nodebreaker0-0 pushed a commit to nodebreaker0-0/substrate that referenced this pull request Nov 29, 2019
nodebreaker0-0 pushed a commit to nodebreaker0-0/substrate that referenced this pull request Nov 29, 2019
nodebreaker0-0 pushed a commit to nodebreaker0-0/substrate that referenced this pull request Nov 29, 2019
nodebreaker0-0 pushed a commit to nodebreaker0-0/substrate that referenced this pull request Nov 29, 2019
nodebreaker0-0 pushed a commit to nodebreaker0-0/substrate that referenced this pull request Nov 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants