This repository has been archived by the owner on Jul 9, 2021. It is now read-only.
[asset-swapper] Bump sampler gas limit and allow for override #2471
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
Sometimes sampling can be over
16e6
gas. On Kovan we had disabled Kyber as sampling can sometimes be55,883,366
fromestimateGas
. It's a crazy amount. If we go over the set gas limit it results in an OOG exception. If unset it uses the current block limit.I've exposed the option so it can be modified in a pinch rather than being a fixed constant.
Perhaps in the future we calculate this based on the numSamples and sources involved (plus some buffer for 0x Native orders)
We do restrict gas limits for Kyber (1.5mil), Eth2Dai (1mil), Uniswap (150k)
34.5e6 = 1.5e6 * 13 + 1e6 * 13 + .15e6 * 13
. So assuming 0 Native orders and13
samples, we need a limit in the worst case of34.5e6
. Setting it to36e6
to accounts for 0x native orders.