function l1CirculatingSupply() public view returns (uint256) {
// After the first update from L1, l1TotalSupply should always be >= l2SupplyFromL1
// The below check is defensive to avoid reverting if this invariant for some reason violated
return
l1TotalSupply >= l2SupplyFromL1
? l1TotalSupply - l2SupplyFromL1
: 0;
}
Tools Used
Remix
Recommended Mitigation Steps
Consider caching the storage variables in the stack.
Handle
Jujic
Vulnerability details
Impact
Some of these variables can be cached to slightly reduce gas usage
Proof of Concept
https://github.com/livepeer/arbitrum-lpt-bridge/blob/ebf68d11879c2798c5ec0735411b08d0bea4f287/contracts/L2/gateway/L2LPTDataCache.sol#L92-L93
Tools Used
Remix
Recommended Mitigation Steps
Consider caching the storage variables in the stack.