Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust time limit for gas price estimation #3313

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

sunce86
Copy link
Contributor

@sunce86 sunce86 commented Mar 6, 2025

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#L26

This 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

  • Make time_limit dynamic (effectively lower) so that the gas price is properly defined according to submission deadline

How 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.

@sunce86 sunce86 self-assigned this Mar 6, 2025
@sunce86 sunce86 requested a review from a team as a code owner March 6, 2025 13:23
@MartinquaXD
Copy link
Contributor

I think providing these time limits makes sense under the assumption that the underlying gas estimator works well to begin with. Could you please do some testing to see how our gas price estimators Native, and Web3 compare to external services? I believe this is only really relevant for estimating the priority fee since for the maxFee we could just use currentBaseFee * 1.125^submission blocks + priorityFee.
Again since all this logic hinges on the gas estimator returning reasonable priority fees we should first double check that this is indeed correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants