code-423n4 / 2022-05-opensea-seaport-findings

1 stars 0 forks source link

Gas Optimizations #137

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

G-1 An length should be cached to save gas in for-loops Some of the for-loops in other contracts already have been doing this but the one below hasn't. https://github.com/code-423n4/2022-05-opensea-seaport/blob/main/contracts/lib/OrderCombiner.sol#:~:text=for%20(uint256%20j%20%3D%200%3B%20j%20%3C%20offer.length%3B%20%2B%2Bj)%20%7B

https://github.com/code-423n4/2022-05-opensea-seaport/blob/main/contracts/lib/OrderCombiner.sol#:~:text=on%20the%20order.-,for%20(uint256%20j%20%3D%200%3B%20j%20%3C%20consideration.length%3B%20%2B%2Bj)%20%7B,-//%20Retrieve%20the%20consideration