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

0 stars 0 forks source link

Gas Optimization: Use unchecked for safe math #231

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

gzeon

Vulnerability details

Impact

Some known to be safe math can be put in a unchecked block to save gas.

Proof of Concept

contracts/L2/gateway/L2LPTDataCache.sol:65

    l2SupplyFromL1 -= _amount;

is safe since _amount <= l2SupplyFromL1

    unchecked{
        l2SupplyFromL1 -= _amount;
    }
yondonfu commented 2 years ago

Duplicate of https://github.com/code-423n4/2022-01-livepeer-findings/issues/173