-
Notifications
You must be signed in to change notification settings - Fork 51
Add events for withholding node rewards #562
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
base: master
Are you sure you want to change the base?
Conversation
contracts/FlowIDTableStaking.cdc
Outdated
| /// Epoch | ||
| access(all) event NewEpoch(totalStaked: UFix64, totalRewardPayout: UFix64, newEpochCounter: UInt64) | ||
| access(all) event EpochTotalRewardsPaid(total: UFix64, fromFees: UFix64, minted: UFix64, feesBurned: UFix64, epochCounterForRewards: UInt64) | ||
| access(all) event NodeRewardsSetToSlash(nodeSlashPercentagesRemaining: {String: UFix64}) |
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 think it's useful to differentiate between withholding rewards and slashing. In my view, slashing is a punitive measure for a protocol violation where part of a node's initial stake amount is confiscated.
I don't think we should refer to withholding rewards as slashing in general. In particular if we plan to pursue performance-based rewards, that blurs the line even further between "getting more rewards for good performance" and "getting less rewards for worse performance".
| access(all) event NodeRewardsSetToSlash(nodeSlashPercentagesRemaining: {String: UFix64}) | |
| // The single parameter is a map from node ID to the percentage of rewards that will be withheld from | |
| // node at each subsequent payout, until the withholding map is modified again. | |
| access(all) event NodeRewardWithholdingsUpdated(nodeRewardWithholdings: {String: UFix64}) |
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, you're right, I forgot about the naming distinction. Thanks for the correction! I'll update it
contracts/FlowIDTableStaking.cdc
Outdated
| access(all) event RewardTokensWithdrawn(nodeID: String, amount: UFix64) | ||
| access(all) event NetworkingAddressUpdated(nodeID: String, newAddress: String) | ||
| access(all) event NodeWeightChanged(nodeID: String, newWeight: UInt64) | ||
| access(all) event NodeRewardsSlashed(nodeID: String, percentageSlashed: UFix64) |
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.
| access(all) event NodeRewardsSlashed(nodeID: String, percentageSlashed: UFix64) | |
| access(all) event NodeRewardsWithheld(nodeID: String, percentageWithheld: UFix64) |
|
should we include a ReasonCode? and then have a table either on chain or just in the docs to begin with which has the mapping of |
|
That is a good idea. I will probably need you to create that page in the docs site though because you'll know those better than I do. Once that page is on the docs site, I can add a link to it in a comment in the contract. Do we think just having the reason code as a |
i don't think we will have more than 2^8 (256) reasons so UInt8 sounds good. |
Closes #446
Adds two events to indicate when nodes are marked to get their rewards withheld and when the withheld rewards are actually calculated