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

QA Report #265

Closed
code423n4 opened this issue Jun 2, 2022 · 1 comment
Closed

QA Report #265

code423n4 opened this issue Jun 2, 2022 · 1 comment
Labels
bug Something isn't working invalid This doesn't seem right QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

It can be seen as an edge case when the reward to notify via the BaseRewardPool is lower than the seconds in a week, It won't likely happen with a reward token with 18 decimals, instead with a 6 decimals token, like the sanUSDC_EUR LP token collected from the angle FeeDistributor contract, this scenario could be present in the first week/s when the ANGLE locked amount could be really low.

function notifyRewardAmount(uint256 reward) internal updateReward(address(0)) {
        historicalRewards = historicalRewards.add(reward);
        if (block.timestamp >= periodFinish) {
            rewardRate = reward.div(duration);
        } else {
            uint256 remaining = periodFinish.sub(block.timestamp);
            uint256 leftover = remaining.mul(rewardRate);
            reward = reward.add(leftover);
            rewardRate = reward.div(duration);
        }
        currentRewards = reward;
        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp.add(duration);
        emit RewardAdded(reward);
    }

Within the notifyRewardAmount when it calculated the rewardRate, if the reward is < duration the rewardRate should be equal to 0, and the reward would be lost.
It can happen, for example with a 6 decimals tokens, when the reward to notify is < 0.604800 (604800 seconds in a week).
It could happen if the reward would be notified to the BaseRewardPool. This pool can support reward token with any decimal, but keep in mind that maybe other reward pool contract could be adapted to support reward token with decimals different than 18.

@code423n4 code423n4 added bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax labels Jun 2, 2022
code423n4 added a commit that referenced this issue Jun 2, 2022
@JeeberC4 JeeberC4 added the invalid This doesn't seem right label Jul 5, 2022
@JeeberC4
Copy link

JeeberC4 commented Jul 5, 2022

Warden submitted multiple QA Reports. Will not be judged.

@JeeberC4 JeeberC4 closed this as completed Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

2 participants