Skip to content

Conversation

@joshuahannan
Copy link
Member

@joshuahannan joshuahannan commented Nov 6, 2025

Closes #446

Adds two events to indicate when nodes are marked to get their rewards withheld and when the withheld rewards are actually calculated

/// 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})
Copy link
Member

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".

Suggested change
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})

Copy link
Member Author

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

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)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
access(all) event NodeRewardsSlashed(nodeID: String, percentageSlashed: UFix64)
access(all) event NodeRewardsWithheld(nodeID: String, percentageWithheld: UFix64)

@joshuahannan joshuahannan changed the title Add events for slashing node rewards Add events for withholding node rewards Nov 7, 2025
@vishalchangrani
Copy link
Contributor

vishalchangrani commented Nov 7, 2025

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
code to reason.
e.g.
ReasonCode 1 - "Node was down for more than 80% of time during the last epoch"
ReasonCode 2 - "Node not updated within 24hr of the Height coordinated upgrade"
Eventually we have many more reasons e.g. incorrect signature on vote for consensus nodes.

@joshuahannan
Copy link
Member Author

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 UInt8 is okay?

@vishalchangrani
Copy link
Contributor

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 UInt8 is okay?

i don't think we will have more than 2^8 (256) reasons so UInt8 sounds good.
Will create a doc site page.

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.

Adds Events for nodes that get rewards slashed

4 participants