Skip to content

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

@DrZoltanFazekas

Description

@DrZoltanFazekas

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions