Closed code423n4 closed 2 years ago
I think this is invalid? I'm not sure I get it, but we need to update the storage anyway.
I don't believe the suggestion provided by the warden is possible. The storage variable must be accessed directly on each iteration.
Title
Costly operations inside unbounded for loop
Impact
ApprovalFollowModule
contract contains for loop which updates the state variable_approvedByProfileByOwner
Proof of Concept
This can be found in the following lines:
https://github.com/aave/lens-protocol/blob/main/contracts/core/modules/follow/ApprovalFollowModule.sol#L41-L43
https://github.com/aave/lens-protocol/blob/main/contracts/core/modules/follow/ApprovalFollowModule.sol#L66-L68
Tools Used
Manual review
Recommended Mitigation Steps
Alternatively a local variable may be assigned temporarily and then assigned to state