using storage instead of memory to declare struct variable inside the function #141
Labels
bug
Something isn't working
G (Gas Optimization)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
rfa
Vulnerability details
Impact
more expensive gas
Proof of Concept
https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/TimeswapPair.sol#L58
instead of caching state on memory. just read it directly from the storage.
State memory state = pools[maturity].state;
Tools Used
self research on:
https://remix.ethereum.org/
Recommended Mitigation Steps
State storage state = pools[maturity].state;
The text was updated successfully, but these errors were encountered: