Worst case asset amount calculations were off by a lot because the fill simulator made the assumption that optimized orders were always sorted. Frequently this would result in worst case buy estimates being better than best case buy estimates. Temporarily sorting the orders before simulating a worst case fill gives us a more realistic lower-bound.
In the Forwarder/Exchange Proxy this manifested as a revert since we were not providing enough input tokens to fill the orders.
Testing instructions
Types of changes
Checklist:
[ ] Prefix PR title with [WIP] if necessary.
[ ] Add tests to cover changes as needed.
[ ] Update documentation as needed.
[ ] Add new entries to the relevant CHANGELOG.jsons.
Description
Worst case asset amount calculations were off by a lot because the fill simulator made the assumption that optimized orders were always sorted. Frequently this would result in worst case buy estimates being better than best case buy estimates. Temporarily sorting the orders before simulating a worst case fill gives us a more realistic lower-bound.
In the Forwarder/Exchange Proxy this manifested as a revert since we were not providing enough input tokens to fill the orders.
Testing instructions
Types of changes
Checklist:
[WIP]
if necessary.