code-423n4 / 2022-02-aave-lens-findings

0 stars 0 forks source link

Gas Optimizations #83

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago
Zer0dot commented 2 years ago

The unpaused check is a good catch!

The 32 byte handles is something we've discussed but breaks the assumption that, via upgradeability, handles could be longer. Anyway right now they are stored in 32 byte words because length is packed in the same slot when it's < 32 bytes. The point about storage accesses is not valid because each element in a struct is accessed separately, loading the entire struct is less efficient. Incrementing the publication count with _createComment introduces a vulnerability that allows the comment to comment on itself, so that's invalid too. Passing the pointed pubCount directly increases the LensHub contract size and is not a tradeoff we want to take. Lastly, the increment point is made invalid by the optimizer.

Zer0dot commented 2 years ago

First issue addressed here: https://github.com/aave/lens-protocol/pull/68