code-423n4 / 2022-10-thegraph-findings

0 stars 0 forks source link

Gas Optimizations #247

Closed code423n4 closed 1 year ago

code423n4 commented 1 year ago

unnecessary call to decreaseAllowance in BridgeEscrow.sol 's revokeAll function,

since the allowance is set back to 0, the approve method can be used:

    function revokeAll(address _spender) external onlyGovernor {
        graphToken().approve(_spender, 0);
        // IGraphToken grt = graphToken();
        // grt.decreaseAllowance(_spender, grt.allowance(address(this), _spender));
    }

running yarn test:gas test/gateway/bridgeEscrow.test.ts in both cases returns a gas optimization of 1596 units