Recommended Mitigation Steps:
by set id in returns L#195 and delete L#196 can save gas
function _getChainID() private pure returns (uint256 id) { //@audit-info: set here
// solhint-disable-next-line no-inline-assembly
assembly {
id := chainid()
}
return id;
}
7.
Title: Expression for constant values such as a call to keccak256(), should use immutable rather than constant
1. Title: Using
!=
inrequire
statement is more gas efficientProof of Concept: L1GraphTokenGateway.sol#L201 L1GraphTokenGateway.sol#L217
Recommended Mitigation Steps: Change
> 0
to!= 0
2. Title: Using multiple
require
instead&&
can save gasProof of Concept: L1GraphTokenGateway.sol#L142 Governed.sol#L54-L56
Recommended Mitigation Steps: Change to:
3. Title: Boolean comparison
Proof of Concept: L1GraphTokenGateway.sol#L214
Recommended Mitigation Steps: Change from
callhookWhitelist[msg.sender] == true
tocallhookWhitelist[msg.sender]
4. Title: abi.encode() is less efficient than abi.encodePacked()
Proof of Concept: GraphTokenUpgradeable.sol#L162 L1GraphTokenGateway.sol#L249 L2GraphTokenGateway.sol#L174
5. Title: Gas improvement on returning
from
andextraData
valueProof of Concept: L2GraphTokenGateway.sol#L286
Recommended Mitigation Steps: by set
from
andextraData
in returns L#286 and delete L#287-288 can save gas6. Title: Gas improvement on returning
id
valueProof of Concept: GraphTokenUpgradeable.sol#L195
Recommended Mitigation Steps: by set
id
in returns L#195 and delete L#196 can save gas7. Title: Expression for
constant
values such as a call tokeccak256()
, should useimmutable
rather thanconstant
Proof of Concept: GraphTokenUpgradeable.sol#L34-L37 GraphTokenUpgradeable.sol#L42-L45
Recommended Mitigation Steps: Change from
constant
toimmutable
reference: here