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

Weighted percentile for gasPrice calculation #2215

Merged
merged 1 commit into from Mar 5, 2024

Conversation

asoto-iov
Copy link
Contributor

@asoto-iov asoto-iov commented Dec 15, 2023

A option to calculate the gas price using weighted percentile considering the gas used is being added to the client. At the same time the legacy calculation is being kept and used as default for now.

Description

Plain percentile calculation was extracted from the gasPriceTracker and a new GasUsed weighted percentile calculator was added in order to update how the gasPrice is being calculated.
The calculator to use (legacy/weighted) can be configured.

Motivation and Context

We want to improve the current algorithm which is being used by eth_gasPrice method. Right now we only consider actual gas price of recently mined txs when we are looking for a price percentile. The suggestion is to besides gas price also consider tx.gasUsed.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Tests for the changes have been added (for bug fixes / features)
  • Requires Activation Code (Hard Fork)
  • Other information:

@asoto-iov asoto-iov changed the title Add initial gasWindow calc Weighted average for gasPrice calculation Jan 4, 2024
@asoto-iov asoto-iov marked this pull request as ready for review January 4, 2024 13:17
@asoto-iov asoto-iov changed the title Weighted average for gasPrice calculation Weighted percentile for gasPrice calculation Jan 25, 2024
@asoto-iov asoto-iov force-pushed the update_gasPrice_tracker branch 2 times, most recently from 64ea989 to 72f648a Compare January 31, 2024 17:41
Copy link

sonarcloud bot commented Jan 31, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

3 New issues
0 Security Hotspots
81.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@Vovchyk
Copy link
Contributor

Vovchyk commented Feb 1, 2024

pipeline:run

1 similar comment
@Vovchyk
Copy link
Contributor

Vovchyk commented Feb 1, 2024

pipeline:run

@Vovchyk
Copy link
Contributor

Vovchyk commented Feb 1, 2024

@asoto-iov lgtm, pls make sure the pipeline is passed

Updating from weighted average to weighted percentile method and naming updates

Minor improvements related with PR comments

Adding GasWeighted calculator and extracted legacy calculation to be able to choose which one could be used.
Copy link

sonarcloud bot commented Mar 5, 2024

@Vovchyk Vovchyk merged commit 64faf03 into master Mar 5, 2024
10 checks passed
@Vovchyk Vovchyk deleted the update_gasPrice_tracker branch March 5, 2024 11:33
@aeidelman aeidelman added this to the Arrowhead 6.1.0 milestone Apr 8, 2024
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.

None yet

4 participants