-
Notifications
You must be signed in to change notification settings - Fork 50
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
Update calculation for automated staking rewards #352
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.
Depending on how the bonus tokens are structured, I suggested a possible alternative which would avoid needing service account approval for each bonus token burn. Not sure if it is feasible though.
Why don't we 'just' burn them ? |
@bluesign Most of the bonus tokens are controlled by accounts that require a multisig between the Flow team and a third party, so getting them back to burn them has been a little bit difficult. We're going to be able to get them all back eventually, hopefully this year, but we really want to enable automatic rewards in the meantime, so we need this workaround in the interim. |
5464880
to
444b6e7
Compare
@joshuahannan ah makes sense, thanks |
@jordanschalm We discussed the rewards event emissions and decided that we still wanted it to be in a different transaction than the move tokens transaction, so I moved it to happen during the staking auction phase only when the Is this a safe way to do this? Is it possible for a view to get skipped or for a view to not change at all between blocks? |
I don't think this works ( view can be skipped ) pub fun main():UInt64 {
var b1 = getCurrentBlock()
var dif1 = (b1.height - b1.view)
var b2 = getBlock(at: b1.height-1440*60)!
var dif2 = (b2.height - b2.view)
return dif2 - dif1
} PS: considering comment on Heartbeat is correct ( and called in every block ) |
No it is not safe. @bluesign is right, views can be skipped. |
okay that makes sense. So do we think we're good with just having the staking auction part of
Added clarification in the comments there too since rewards can only be paid once anyway |
Even though the number of event's will be much lower, the
This will cause problems as to process rewards events from previous blocks. Wouldn't be better to address the large number of events by other way? There are many delegators receiving very small amounts like 0.00000006, probably because they can't pay for the transaction fee or something. It makes sense to limit the minimum amount to have staked as to receive rewards. Or the minimum amount to receive reward (the dust can go to the Node Operator). Plus there are many events that they are For example, in
From those 16593, 10152 are greater than 0.01 Flow:
And 3909 greater than 1 Flow :
|
@yagop Thank you so much for the feedback! Because of your feedback, we decide that we're going to hold off on changing the delegator rewards events for now and try to find a better solution for the events problem. I'm going to create a FLIP for requiring a minimum stake for delegators to receive rewards and I'm also going to propose a cadence flag that allows the protocol contracts to turn off event emission for the unnecessary events. We also might work to split up rewards payments into multiple transactions so they aren't as large. I'll share the FLIPs here after I've proposed them. Thanks again! |
Glad to help, many thanks @joshuahannan ! 🙇 |
This has been implemented (on 5/3). See the following PRs - onflow/service-account#238 onflow/flow-core-contracts#352 onflow/flow-core-contracts#365
This has been implemented (on 5/3). See the following PRs - onflow/service-account#238 onflow/flow-core-contracts#352 onflow/flow-core-contracts#365
This has been implemented (on 5/3). See the following PRs - onflow/service-account#238 onflow/flow-core-contracts#352 onflow/flow-core-contracts#365
Automated Staking Rewards
In preparation for enabling automated staking rewards on Flow mainnet, this PR adds a few lines to change how rewards are calculated. There was a batch of tokens from Flow Genesis that were minted as a necessary incentive structure for proper decentralization. These tokens are not circulating and were never meant to be included in the true total supply calculation. Because FLOW has hit its decentralization milestones, these tokens are meant to be burned. Most of them have been burnt and will be burnt in the future, but unfortunately, it has been difficult to access all of them at once to burn them, so there are still some remaining.
This change adds a section when calculating the reward amount for the next epoch that subtracts the current amount of bonus tokens remaining from the expected total supply so that the inflation amount is calculated from the expected supply not including bonus tokens instead of the total supply. This will result in less tokens being minted per epoch than there would be if the bonus tokens were included.
The process for updating this value will go through the service account committee. When bonus tokens are burnt, a proposal will be posted as a PR in the service account repo where the committee will review it and schedule a multisign to update the value. These changes will be very infrequent because we would prefer to burn large batches of bonus tokens instead of little amounts every time.
The initial value is expected to be something around 20M
Update Rewards Events
Rewards payment is now happening automatically in the system chunk transaction, so events will not be queryable in the same way as before. Any projects that rely on rewards events will need to update to be compatible. Instructions are here: https://forum.onflow.org/t/breaking-change-coming-to-flow-epoch-smart-contracts-for-automatic-rewards/4516We will make sure to broadcast this change very widely to all affected users if it is approved.