Closed code423n4 closed 2 years ago
p4st13r4
LivePeerToken.sol assigns two constants to the result of a keccak operation, which results in gas waste since the expression is computed each time the constant is accessed.
LivePeerToken.sol
See this issue for more context: https://github.com/ethereum/solidity/issues/9232
https://github.com/livepeer/arbitrum-lpt-bridge/blob/main/contracts/L2/token/LivepeerToken.sol#L9
Editor
Replace the constant directive with immutable, or assign the already hashed value to the constants
constant
immutable
Duplicate of https://github.com/code-423n4/2022-01-livepeer-findings/issues/172
Handle
p4st13r4
Vulnerability details
Impact
LivePeerToken.sol
assigns two constants to the result of a keccak operation, which results in gas waste since the expression is computed each time the constant is accessed.See this issue for more context: https://github.com/ethereum/solidity/issues/9232
Proof of Concept
https://github.com/livepeer/arbitrum-lpt-bridge/blob/main/contracts/L2/token/LivepeerToken.sol#L9
Tools Used
Editor
Recommended Mitigation Steps
Replace the
constant
directive withimmutable
, or assign the already hashed value to the constants