contracts icon indicating copy to clipboard operation
contracts copied to clipboard

How about blockInterval bigger than checkPointBlockInterval * maxRewardedCheckpoints ?

Open VictorECDSA opened this issue 3 years ago • 0 comments

    function _calculateCheckpointReward(uint256 blockInterval, uint256 signedStakePower, uint256 currentTotalStake) internal returns (uint256) {

        // ......

        if (blockInterval > targetBlockInterval) {
            // count how many full intervals
            uint256 _rewardDecreasePerCheckpoint = rewardDecreasePerCheckpoint;

            // calculate reward for full intervals
            reward = ckpReward.mul(fullIntervals).sub(ckpReward.mul(((fullIntervals - 1) * fullIntervals / 2).mul(_rewardDecreasePerCheckpoint)).div(CHK_REWARD_PRECISION));
            // adjust block interval, in case last interval is not full
            blockInterval = blockInterval.sub(fullIntervals.mul(targetBlockInterval));
            // adjust checkpoint reward by the amount it suppose to decrease
            ckpReward = ckpReward.sub(ckpReward.mul(fullIntervals).mul(_rewardDecreasePerCheckpoint).div(CHK_REWARD_PRECISION));
        }

        // give proportionally less for the rest
        reward = reward.add(blockInterval.mul(ckpReward).div(targetBlockInterval));
        reward = reward.mul(signedStakePower).div(currentTotalStake);
        return reward;

Let's give these variables a simple name as follow: x: input blockInterval p: input signedStakePower q: input currentTotalStake t: checkPointBlockInterval or targetBlockInterval d: rewardDecreasePerCheckpoint m: maxRewardedCheckpoints n: fullIntervals e: blockInterval.sub(fullIntervals.mul(targetBlockInterval)) r: ckpReward y: returning reward

They satisfy the following relationships: x = n * t + e, n <= m 企业微信截图_16600409017172

Since n max is m, the number of remaining blocks in x is e. Thus when x has exceeded m * t, then n = m, e increases with x. Thus, the terms in the polynomial related to n become constants, and the final result y increases as e increases. Does this incite proposers to wait for more blocks to submit?

VictorECDSA avatar Aug 09 '22 10:08 VictorECDSA