Open code423n4 opened 2 years ago
Details: Consider the following changes to OrderCombiner.sol:
OrderCombiner.sol
--maximumFulfilled;
++totalFilteredExecutions;
For more information, see G012 of c4-common-issues.
Profile: Using yarn profile the following report was obtained:
yarn profile
Before gas optimization
······························|··································|·············|·············|···············|···············|·············· | Seaport · fulfillAdvancedOrder · 104014 · 209693 · 162960 · 112 · - │ ······························|··································|·············|·············|···············|···············|·············· | Seaport · fulfillAvailableAdvancedOrders · 173305 · 229465 · 205136 · 16 · - │ ······························|··································|·············|·············|···············|···············|·············· | Seaport · fulfillAvailableOrders · 172879 · 229282 · 206787 · 13 · - │ ······························|··································|·············|·············|···············|···············|··············
After gas optimization
······························|··································|·············|·············|···············|···············|·············· | Seaport · fulfillAdvancedOrder · 104014 · 209631 · 162947 · 112 · - │ ······························|··································|·············|·············|···············|···············|·············· | Seaport · fulfillAvailableAdvancedOrders · 173343 · 229451 · 205128 · 16 · - │ ······························|··································|·············|·············|···············|···············|·············· | Seaport · fulfillAvailableOrders · 172879 · 229282 · 206786 · 13 · - │ ······························|··································|·············|·············|···············|···············|··············
Pre-incrementing (resp. pre-decrementing) a variable is cheaper than post-incrementing (resp. post-decrementing) it
Details: Consider the following changes to
OrderCombiner.sol
:--maximumFulfilled;
.++totalFilteredExecutions;
.For more information, see G012 of c4-common-issues.
Profile: Using
yarn profile
the following report was obtained:Before gas optimization
After gas optimization