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

feat: epoched reward distribution #3288

Merged
merged 4 commits into from
Jun 14, 2021
Merged

feat: epoched reward distribution #3288

merged 4 commits into from
Jun 14, 2021

Conversation

JimLarson
Copy link
Contributor

See #3114

@JimLarson JimLarson self-assigned this Jun 10, 2021
@JimLarson JimLarson marked this pull request as ready for review June 12, 2021 03:44
@JimLarson JimLarson requested a review from michaelfig June 12, 2021 03:44
Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

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

Really close. Please just fix the reliance on Int64, and then I'll be happy to approve.

coins := make([]sdk.Coin, 0)
if blocks > 0 {
for _, coin := range pool {
amt := coin.Amount.Int64()
Copy link
Member

Choose a reason for hiding this comment

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

Just to be pedantic, please don't cast a coin.Amount to an Int64, since it technically could overflow. Please use sdk.Int comparisons and math instead.

This may seem silly at this point, but if we ever decide to use coins which are represented in about 18 decimalPlaces (such as most coins transferred from Ethereum), we quickly overflow Int64.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Checked that this was the only int64 assumption and added a test with large amounts.

Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

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

LGTM! Really good!

@JimLarson JimLarson enabled auto-merge June 14, 2021 18:47
First, buffer the rewards in the vbank module.
When fees are sent to vbank at the epoch, calculate a rate for
distributing them to exhaust the reward pool by theend of the epoch.
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.

2 participants