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

Distorted reward attribution due to stake (de)activation delayed by up to 2 epochs #10

Open
DrZoltanFazekas opened this issue Nov 19, 2024 · 0 comments

Comments

@DrZoltanFazekas
Copy link
Contributor

DrZoltanFazekas commented Nov 19, 2024

The delegation contracts assume that delegators start contributing to the rewards earned by the validator from the point when they delegate their stake. However, this is not true since the delegated stake is only added to the validator's deposit in the epoch after next. Smilarly, the contracts assume that unstaking has immediate effect on the validator's deposit i.e. the delegator's contribution to the rewards earned by the validator are decreased accordingly. This is also not correct and it could be misused by delegators to maximize their share of the rewards at the expense of other delegators by staking in the first and unstaking in the last block of an epoch and thereby receiving a share of the rewards for up to 3599 additional blocks during which they were not contributing to the rewards earned by the validator.

For instance, a staker who delegated 10% of the total deposit of a validator who controls 10% of the total stake (at the current staking ratio this amounts to 52m ZIL), could earn up to 3599 * 51000 / 3600 * 0.1 * 0.1 ~ 510 ZIL additionally. The draining attack can be repeated every 14,400 blocks i.e. 4 hours.

One way of restoring fairness is to introduce a bonus/malus based on the staking block.number % 3600 and the unstaking block.number % 3600.

@DrZoltanFazekas DrZoltanFazekas changed the title Incorrect reward attribution due to stake (de)activation delayed by up to 2 epochs Distorted reward attribution due to stake (de)activation delayed by up to 2 epochs Dec 13, 2024
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

No branches or pull requests

1 participant