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
Rank: 15/21
Findings: 2
Award: $473.30
🌟 Selected for report: 0
🚀 Solo Findings: 0
Low
constructor
)initialize
).......
#0 - Zer0dot
2022-03-24T19:55:54Z
Constructor issue solved in https://github.com/aave/lens-protocol/pull/80, initialization is a tradeoff we're willing to take, since the hub is only initialized at proxy construction, an error here would mean redeployment as far as I can tell, which is alright. The reason we implemented the checks in constructors is because constructors are not part of the runtime code, so don't affect the code size.
Handle stuff is meant to be delegated to whitelisted profile creators.
sig
close to followModule
in DataTypes.sol#L125sig
close to referenceModule
in DataTypes.sol#L208, DataTypes.sol#L257 and DataTypes.sol#L294sig
close to follower
in DataTypes.sol#L310sig
close to collector
in DataTypes.sol#L328before:
function setEmergencyAdmin(address newEmergencyAdmin) external override onlyGov { address prevEmergencyAdmin = _emergencyAdmin; _emergencyAdmin = newEmergencyAdmin; emit Events.EmergencyAdminSet( msg.sender, prevEmergencyAdmin, newEmergencyAdmin, block.timestamp ); }
after:
function setEmergencyAdmin(address newEmergencyAdmin) external override onlyGov { emit Events.EmergencyAdminSet( msg.sender, _emergencyAdmin, newEmergencyAdmin, block.timestamp ); _emergencyAdmin = newEmergencyAdmin; }
This logic could be used to save gas in:
false
or 0
)whitelist=false
in LensHub.sol#L107whitelist=false
in LensHub.sol#L113whitelist=false
in LensHub.sol#L123toWhitelist=false
in ModuleGlobals.sol#L118storage
keyword for save gas in order to cache a storage pointer._dataByPublicationByProfile[profileId][pubId]
in FeeCollectModule.sol#L75-L78_dataByPublicationByProfile[profileId][pubId]
in LimitedFeeCollectModule.sol#L82-L86_dataByPublicationByProfile[profileId][pubId]
in LimitedTimedFeeCollectModule.sol#L89-L94_dataByPublicationByProfile[profileId][pubId]
in TimedFeeCollectModule.sol#L84-L88#0 - Zer0dot
2022-03-25T15:24:21Z
First point is invalid, those are not stored but are only ever used calldata. Second point is technically valid, but the impact is not enough to be worth the readability change as the only time this would be helpful is when a user attempts to call the implementation. We emit events at the end by convention for readability, since these are governance/admin functions anyway, we don't see much value in implementing this.
Using delete doesn't seem to make sense to me either, as this would add logic in certain cases and I find setting a boolean to false
is clearer for readability. This should be handled by the optimizer and the impact appears negligible, if any. Finally using the storage pointer actually increased gas, so we're not doing that either.
Still, though these points are not valid for our case, they are still pretty well thought out!