Skip to content
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

Merged
merged 3 commits into from
Feb 6, 2020

Conversation

dekz
Copy link
Member

@dekz dekz commented Feb 5, 2020

Description

Sometimes sampling can be over 16e6 gas. On Kovan we had disabled Kyber as sampling can sometimes be 55,883,366 from estimateGas. 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 and 13 samples, we need a limit in the worst case of 34.5e6. Setting it to 36e6 to accounts for 0x native orders.

@buildsize

This comment has been minimized.

Copy link
Contributor

@dorothy-zbornak dorothy-zbornak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's probably more to this but if this works, great 🙃

@coveralls
Copy link

coveralls commented Feb 6, 2020

Coverage Status

Coverage decreased (-0.03%) to 79.588% when pulling e36181d on fix/asset-swapper/sampler-gas-limit into ee9ef9f on development.

@dekz dekz merged commit 4a62e80 into development Feb 6, 2020
@dekz dekz deleted the fix/asset-swapper/sampler-gas-limit branch February 6, 2020 02:31
dorothy-zbornak pushed a commit that referenced this pull request Feb 27, 2020
* [asset-swapper] Bump sampler gas limit and allow for override

* Fix imports

* Set to 36e6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants