Aave Lens contest - nahnah's results

Web3 permissionless, composable & decentralized social graph

General Information

Platform: Code4rena

Start Date: 10/02/2022

Pot Size: $100,000 USDC

Total HM: 13

Participants: 21

Period: 7 days

Judge: leastwood

Total Solo HM: 10

Id: 85

League: ETH

Aave Lens

Findings Distribution

Researcher Performance

Rank: 19/21

Findings: 1

Award: $242.67

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: Dravee

Also found by: 0x0x0x, 0x1f8b, IllIllI, Jujic, csanuragjain, d4rk, defsec, gzeon, nahnah, pauliax, rfa

Labels

bug
G (Gas Optimization)

Awards

242.6669 USDC - $242.67

External Links

1. Title : multiple .length call on byteHandle

Summary

It is cheaper to save the length value of the byteHandle in a local variable than call the .length in every if condition and loop

POC https://github.com/code-423n4/2022-02-aave-lens/blob/main/contracts/libraries/PublishingLogic.sol#L400-L403

2. Title : many function calculation called with the same result

Summary

this function called many times when user interacting with LensHub. therefore it is cheaper to save the value to a variable in constructor

POC https://github.com/code-423n4/2022-02-aave-lens/blob/main/contracts/core/base/LensNFTBase.sol#L173

3. Title : many boolean operation with the same result

Summary

It is cheaper to save boolean operation result in the local memory when It is going to be used many times.

POC https://github.com/code-423n4/2022-02-aave-lens/blob/main/contracts/core/FollowNFT.sol#L231-L264

before

function _moveDelegate( address from, address to, uint256 amount ) internal { unchecked { if (from != address(0)) { //statement } if (to != address(0)) { if (from == address(0)) { //statement } } else{ if(from != address(0)){ //statement } } } }

after

function _moveDelegate( address from, address to, uint256 amount ) internal { unchecked { bool fromZero = from == address(0); if (!fromZero) { //statement } if (to != address(0)) { if (fromZero) { //statement } } else{ if(!fromZero){ //statement } } } }

#0 - Zer0dot

2022-03-24T19:59:04Z

Great! Except for the 2nd point, although this is valid, we're opting to keep the domain separator calculation as is, it's future-proof, but perhaps down the line in a contract upgrade we can optimize this. All in this PR: https://github.com/aave/lens-protocol/pull/80

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