Closed code423n4 closed 2 years ago
_notPaused()
Managed.notPartialPaused
Reduces Staking deploy gas by 37000, but also increases GNS deploy gas by 36000. Should be applied based on the deploy preferences.
BridgeEscrow.revokeAll sets approval of _spender to zero. The current implementation, i.e.
_spender
IGraphToken grt = graphToken(); grt.decreaseAllowance(_spender, grt.allowance(address(this), _spender));
can be changed to:
graphToken().approve(_spender, 0);
This decreases gas used per call by 1600 and per deployment by 43000.
The affected code:
require( pendingGovernor != address(0) && msg.sender == pendingGovernor, "Caller must be pending governor" );
pendingGovernor is required to be msg.sender, and if that condition satisfies it cannot be the zero-address. So that check can be safely removed.
pendingGovernor
msg.sender
This submission presents unique/interesting findings so we would like the judges to consider it as of high quality.
[G-1] Use
_notPaused()
insideManaged.notPartialPaused
to remove duplicated code and reduce gas usageReduces Staking deploy gas by 37000, but also increases GNS deploy gas by 36000. Should be applied based on the deploy preferences.
[G-2] Set allowance to 0 instead of decreasing allowance by approved amount
BridgeEscrow.revokeAll sets approval of
_spender
to zero. The current implementation, i.e.can be changed to:
This decreases gas used per call by 1600 and per deployment by 43000.
[G-3] Unnecessary zero-address check for msg.sender in Governed.acceptOwnership
The affected code:
pendingGovernor
is required to bemsg.sender
, and if that condition satisfies it cannot be the zero-address. So that check can be safely removed.