Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

How about blockInterval bigger than checkPointBlockInterval * maxRewardedCheckpoints ? #420

Open
VictorECDSA opened this issue Aug 9, 2022 · 0 comments

Comments

@VictorECDSA
Copy link

VictorECDSA commented Aug 9, 2022

    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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant