Cache Reference To State Variable "currentAuctionID" in _checkAuctionFinalization (Auction.sol) #89
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
ye0lde
Vulnerability details
Impact
Caching the references to "currentAuctionID" will decrease gas usage.
Proof of Concept
The state variable "currentAuctionID" is read 7 times in function "_checkAuctionFinalization" here:
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/Auction.sol#L746-L762
Tools Used
Visual Studio Code, Remix
Recommended Mitigation Steps
I suggest making the changes below to cache the variable:
The text was updated successfully, but these errors were encountered: