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

Gas estimation is suboptimal #10

Open
paulbarclay opened this issue Aug 6, 2021 · 1 comment
Open

Gas estimation is suboptimal #10

paulbarclay opened this issue Aug 6, 2021 · 1 comment

Comments

@paulbarclay
Copy link

There's a number of issues with the current code, but they all boil down to very poor gas estimation.

  1. The calculation only looks at transactions - it ignores blocks that aren't full.

  2. The calculation only looks at gas price for the transaction, so smaller transactions (which tend towards higher gas prices) take up a disproportionate piece of the total gas.

[FIX 1&2]: These two can be solved by weighting by gas cost - make the percentage the % of 20,000,000 that the token fills.

  1. The buffer only holds 2-3 blocks worth of transactions. To calculate a more stable price, you need a longer lookback.

[FIX 3]: Rather than calculating over a buffer, run the calculation for each block individually (including the weighting from fix 1&2), store the values for each block using, and weighted average over a different number of blocks for each one (highest 10 of the last 15 blocks for safelow, highest 7 for standard, highest 4 for fast, and highest 2 for fastest)

  1. The percentage calculations value outliers incredibly highly.

[FIX 4]: Use 98% rather than 100% for "highest". There's no need to match a single over-high data point when your goal is "just get this confirmed"

  1. The calculation doesn't take into account how long pending transactions have been waiting - "safelow" and "fast" transactions complete at the same speed.
@Berky99
Copy link

Berky99 commented Apr 7, 2024

Bb

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

No branches or pull requests

2 participants