-
Notifications
You must be signed in to change notification settings - Fork 215
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
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.
Really close. Please just fix the reliance on Int64
, and then I'll be happy to approve.
golang/cosmos/x/vbank/vbank.go
Outdated
coins := make([]sdk.Coin, 0) | ||
if blocks > 0 { | ||
for _, coin := range pool { | ||
amt := coin.Amount.Int64() |
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.
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
.
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.
Done. Checked that this was the only int64 assumption and added a test with large amounts.
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! Really good!
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.
af67446
to
fabfacb
Compare
See #3114