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

0 stars 0 forks source link

Use abi.encodePacked for gas optimization #225

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

defsec

Vulnerability details

Impact

Changing the abi.encode function to abi.encodePacked at line 355 of L1Migrator can save gas since the abi.encode function pads extra null bytes at the end of the call data, which is unnecessary. Also, in general, abi.encodePacked is more gas-efficient.

Proof of Concept

https://github.com/livepeer/arbitrum-lpt-bridge/blob/ebf68d11879c2798c5ec0735411b08d0bea4f287/contracts/L1/gateway/L1Migrator.sol#L355

Tools Used

Code Review

Recommended Mitigation Steps

Change abi.encode to abi.encodePacked at line 355.