Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The driver has a routine to prioritize orders and filter orders based on the balance the trader currently has.
With the introduction of pre-interactions this check became much trickier because a user might not have any sell_tokens at the moment but unstakes the needed tokens in a pre-interaction. Because of that we introduced a way to get the actual tradable balance by simulating a balance check using a helper contract.
This is very accurate but unfortunately also very slow. (~10s just for fetching the balances of all traders in an auction)
Luckily most of our orders don't have pre-interactions so we can fall back to a simpler and faster way to query the current balance.
Changes
Reimplement parts of the balance query of balances.sol using simple
eth_call
s and use that for any order group that does not contain any pre-interactions.While testing locally this reduced the time to fetch all balances to ~ 1.2 - 2 seconds.
How to test
covered by e2e tests
Related Issues
#2041