code-423n4 / 2022-01-openleverage-findings

0 stars 0 forks source link

Considered changing memory to storage #231

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

Tomio

Vulnerability details

Impact

Expensive gas

Proof of Concept

https://github.com/code-423n4/2022-01-openleverage/blob/main/openleverage-contracts/contracts/XOLE.sol#L326 // gas cost 26049

Tools Used

Remix

Recommended Mitigation Steps

Change to:

LockedBalance storage _locked = locked[msg.sender];
// gas cost 25954

and remove https://github.com/code-423n4/2022-01-openleverage/blob/main/openleverage-contracts/contracts/XOLE.sol#L333, not needed if use storage

ColaM12 commented 2 years ago

Duplicate to #137