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 #209

Open
code423n4 opened this issue Oct 30, 2022 · 1 comment
Open

QA Report #209

code423n4 opened this issue Oct 30, 2022 · 1 comment
Labels
bug Something isn't working grade-b Q-49 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

code423n4 commented Oct 30, 2022

Missing check for votesDifference

There is no check for votesDifference in https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L325. If receiver balance of veCRV equals targetVotes this would create a Pledge with zero totalRewardAmount, making this pledge useless as no rational user will pledge without receiving rewards.

    vars.votesDifference = targetVotes - votingEscrow.balanceOf(receiver);

    vars.totalRewardAmount = (rewardPerVote * vars.votesDifference * vars.duration) / UNIT;

Please consider checking vars.votesDifference > 0 and reverting with the appropriate error.

totalDelegatedAmount and rewardAmount calculated incorrectly

The following expression for calculating totalDelegatedAmounts has an extra bias term (https://github.com/code-423n4/2022-10-paladin/blob/d6d0c0e57ad80f15e9691086c9c7270d4ccfe0e6/contracts/WardenPledge.sol#L259-L265), opposed to what is defined in boostV2 contract (https://github.com/curvefi/curve-veBoost/blobdb3dec43b6e4fac0fca1f01509f9133563f43ebb/contracts/BoostV2.vy#L191-L206). Therefore the totalDelegatedAmounts overstates the actual amount pledged per sec, consequently also overstating rewardAmount.

    uint256 totalDelegatedAmount = ((bias * boostDuration) + bias) / 2;

Please consider removing the extra bias term, as shown below.

    uint256 totalDelegatedAmount = (bias * boostDuration) / 2;
@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 Oct 30, 2022
code423n4 added a commit that referenced this issue Oct 30, 2022
code423n4 added a commit that referenced this issue Oct 30, 2022
@c4-judge
Copy link
Contributor

kirk-baird marked the issue as grade-b

@C4-Staff C4-Staff added the Q-49 label Dec 6, 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 grade-b Q-49 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

3 participants