Canto v2 contest - hake's results

Execution layer for original work.

General Information

Platform: Code4rena

Start Date: 28/06/2022

Pot Size: $25,000 USDC

Total HM: 14

Participants: 50

Period: 4 days

Judge: GalloDaSballo

Total Solo HM: 7

Id: 141

League: ETH

Canto

Findings Distribution

Researcher Performance

Rank: 28/50

Findings: 2

Award: $65.27

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

43.4708 USDC - $43.47

Labels

bug
QA (Quality Assurance)

External Links

QA Report

[L-01] Missing zero address check

Mistakenly setting WethAddr to zero might lead to a loss of funds.

I recommend implementing a zero address check.

https://github.com/Plex-Engineer/lending-market-v2/blob/main/contracts/Comptroller.sol#L1479

#0 - GalloDaSballo

2022-08-13T22:33:55Z

Valid L

Awards

21.8032 USDC - $21.80

Labels

bug
G (Gas Optimization)

External Links

Gas Report

[G-01] for loop optimisation

for (uint i = 0; i < proposal.targets.length; i++) {
    timelock.executeTransaction{value: proposal.values[i]}(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
}

Gas could be saved by:

  • Not initializing variable to default value of zero
  • Caching array length
  • Using a prefix (++i) instead of a postfix (i++)
  • Unchecking increment count

Example:


uint length = proposal.targets.length;

for (uint i; i < length;) {
    timelock.executeTransaction{value: proposal.values[i]}(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta);
		unchecked { ++i; }
}

https://github.com/Plex-Engineer/lending-market-v2/blob/main/contracts/Governance/GovernorBravoDelegate.sol#L88

#0 - GalloDaSballo

2022-08-14T20:49:10Z

25 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