FlatOperator can be inlined into NestedFactory to save gas #26
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Handle
TomFrench
Vulnerability details
Impact
Reduced gas costs from not having to load operator address from storage and make external contract call to FlatOperator
Proof of Concept
FlatOperator is going to be used on almost any operation as it's very likely that people will be investing into a portfolio using one of the tokens in that portfolio. Despite having all the information necessary to return the correct output
NestedFactory
has to load theFlatOperator
address from storage and then make a contract call to theFlatOperator
(touching an additional contract) incurring all the associated costs of this.As the
FlatOperator
is such a simple and commonly used operator it's worth inlining it intoNestedFactory._submitOrder
andNestedFactory._safeSubmitOrder
._submitOrder
could then be modified as similarly to this:We then shortcut this function saving gas.
Recommended Mitigation Steps
Something similar to above snippet.
The text was updated successfully, but these errors were encountered: