Adjust time limit for gas price estimation #3313
Open
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
A follow up to #3312
Currently, all gas prices in
driver
are determined by using the default time limit of 30s as targeted inclusion time - https://github.com/cowprotocol/gas-estimation/blob/main/src/lib.rs#L26This is static and equal for all networks, always (even during volatility times, although one can argue that volatility is expected to be handled by gas estimators themselves, hopefully).
This PR implements defining this parameter based on the submission deadline, per each network.
In practice, solvers on different networks are given different number of blocks as submission deadline:
Mainnet - 3 blocks
Base - 20 blocks
Arbitrum - 40 blocks
Gnosis - 5 blocks
Sepolia - 5 blocks
Taken from https://aws-es.cow.fi/_dashboards/goto/ba5daa93d871ff3d7099d5e3462ddd28?security_tenant=global
This effectively means that this PR reduces the time limit from 30s to:
Mainnet - 3 * 12s / 2 = 18s
Base - 20 * 2s / 2 = 20s
Arbitrum - 40 * 0.25 / 2 = 5s
Gnosis - 5 * 5s / 2 = 12.5s
Sepolia - 5 * 12s / 2 = 30s
Changes
time_limit
dynamic (effectively lower) so that the gas price is properly defined according to submission deadlineHow to test
This is a bit riskier change that could potentially increase the gas prices more than we expect. That said, all networks will be debugged/observed on staging first.