veRWA - sl1's results

Incentivization Primitive for Real World Assets on Canto

General Information

Platform: Code4rena

Start Date: 07/08/2023

Pot Size: $36,500 USDC

Total HM: 11

Participants: 125

Period: 3 days

Judge: alcueca

Total Solo HM: 4

Id: 274

League: ETH

Canto

Findings Distribution

Researcher Performance

Rank: 119/125

Findings: 1

Award: $4.23

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/VotingEscrow.sol#L185-L218 https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/GaugeController.sol#L69-L83 https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/GaugeController.sol#L95-L109 https://github.com/code-423n4/2023-08-verwa/blob/a693b4db05b9e202816346a6f9cada94f28a2698/src/GaugeController.sol#L247-L249

Vulnerability details

Impact

VotingEscrow.sol and GaugeController.sol rely on several loops that can loop for hundred of times while being costly in terms of gas consumption.

for (uint256 i = 0; i < 255; i++) {
for (uint256 i; i < 500; ++i) {

These loops are executed on every interaction with each of the smart contracts.

Moreover in GaugeController.sol there are two calls to two different loops in the same function vote_for_gauge_weights.

uint256 old_weight_bias = _get_weight(_gauge_addr);
uint256 old_weight_slope = points_weight[_gauge_addr][next_time].slope;
uint256 old_sum_bias = _get_sum();

In one single function call the smart contract is expected to iterate both of these loops with each loop having upper bound of 500 iterations. This approach is error-prone and if the number of periods is large, the contract is essentially deemed useless as his core-functionality will be broken. I consider this to be a Medium severity as assets are not at direct-risk but the core function of the protocol and it's availability could be impacted.

Tools Used

VS-Code/Manual Review

The good approach could be allowing iteration over periods in mutliple transactions.

Assessed type

Loop

#0 - c4-pre-sort

2023-08-12T09:38:49Z

141345 marked the issue as duplicate of #160

#1 - c4-judge

2023-08-24T05:48:26Z

alcueca marked the issue as unsatisfactory: Insufficient proof

#2 - c4-judge

2023-08-28T14:32:01Z

alcueca changed the severity to QA (Quality Assurance)

#3 - c4-judge

2023-08-28T14:32:58Z

alcueca marked the issue as grade-b

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