veToken Finance contest - fatherOfBlocks's results

Lock more veAsset permanently.

General Information

Platform: Code4rena

Start Date: 26/05/2022

Pot Size: $75,000 USDT

Total HM: 31

Participants: 71

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 18

Id: 126

League: ETH

veToken Finance

Findings Distribution

Researcher Performance

Rank: 61/71

Findings: 1

Award: $56.83

🌟 Selected for report: 0

🚀 Solo Findings: 0

VeAssetDepositor.sol

  • L28 - it is not necessary to set a variable with its default value, this generates a higher gas cost.

  • L89/117/132/138 - It is more expensive to validate that variable > 0 than variable != 0, therefore it is recommended to validate it like this.

Booster.sol

  • L124/130/136/146/163/169/179/194/226/231/244/261/262/309/326/350/352 - A require generates too much gas cost, which could be avoided with an if and a custom error or using a private view function.

  • L329 - Several improvements can be made in the for, first there is no need to initialize a variable with default value and second i++ is more expensive than unchecked{++i;}

  • L517/526/541/551/556/562/586/590 - It is more expensive to validate a variable > 0 than a variable != 0, therefore it is recommended to validate it like this.

  • L352/498 - It is less expensive to validate that a variable is true and false directly than to validate (variable == true) or (variable == false)

BaseRewardPool.sol

  • L66/67/70/71/72 - it is not necessary to set a variable with its default value, this generates a higher gas cost.

  • L122/123/124/132/173/196/215/301 - A require generates too much gas cost, which could be avoided with a custom if and error or by using a private view function.

  • L137 - The updateReward() modifier could be a private view function and does not generate any gas cost.

  • L173/196/215/273- It is more expensive to validate that variable > 0 than variable != 0, therefore it is recommended to validate it like this.

  • L176/199/218/245/282 - Several improvements can be made in the for, first there is no need to initialize a variable with default value and second i++ is more expensive than unchecked{++i;}

  • L124 - As extraRewards are added one by one, instead of validating in a require (extraRewards.length < EXTRA_REWARD_POOLS) it could be validated: (extraRewards.length != EXTRA_REWARD_POOLS), and this would result in less gas cost.

VE3DRewardPool.sol

  • L210/234/253/285 - It is more expensive to validate that variable > 0 than variable != 0, therefore it is recommended to validate it like this.

  • L148/214/238/257/281/326 - Several improvements can be made in the for, first there is no need to initialize a variable with default value and second i++ is more expensive than unchecked{++i;}

  • L146 - The updateReward() modifier could be a private view function and does not generate any gas cost.

VoterProxy.sol

  • L30/31 - The name and escrowModle variables are only set in the constructor and never change, they could be immutable, so that the gas cost is lower.

  • L100 - It is more expensive to validate a variable > 0 than a variable != 0, therefore it is recommended to validate it like this.

  • L217 - Several improvements can be made in the for, first there is no need to initialize a variable with default value and second i++ is more expensive than unchecked{++i;}

  • L63/68/69/78/84/92/110/128/139/151/159/167/173/186/211/225/257/263/279/282 - A require generates too much gas cost, which could be avoided with an if and a custom error or by using a private view function.

  • L70/93/96/110/113 - It is not necessary to validate that "bool variable" is == true, since it generates an extra gas expense, directly the if could work without the "== true".

  • L227 - it is not necessary to set a variable with its default value, this generates a higher gas cost.

#0 - GalloDaSballo

2022-07-14T02:01:00Z

1k for the findings and 4200 for the 2 immutables

Roughly 5200 gas saved

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter