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

fix(gas): gas price oracle improvements #519

Merged
merged 1 commit into from
Feb 5, 2024
Merged

Conversation

ptrus
Copy link
Member

@ptrus ptrus commented Feb 5, 2024

Gas price oracle heuristics are updated to return better gas price estimates for the eth_gasPrice queries. Instead of returning the minimum gas price from the recent blocks, the maximum of the median gas price from recent full blocks is returned. Additionally the gas oracle parameters are now configurable, and the defaults are lowered to better detect full blocks.

@ptrus ptrus requested a review from kostko as a code owner February 5, 2024 09:23
Copy link
Member

@kostko kostko left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

gas/backend.go Outdated
return
}
g.trackPrice(lastTxPrice)

g.trackPrice(medTxPrice)
Copy link
Member

Choose a reason for hiding this comment

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

Should an epsilon be added here still? Otherwise if the queue is full of transactions with gas price X and the median gas price is also X, your transaction is not likely to make it into the next block? Ideally one would look into the current txqueue as well (to estimate where your transaction would be), but until that is not there, it would be better to still add a small epsilon as long as the blocks are full?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah makes sense 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

@ptrus ptrus force-pushed the ptrus/fix/gas-price-oracle branch 2 times, most recently from 201c92e to 9aed169 Compare February 5, 2024 10:03
Gas price oracle heuristics are updated to return better gas price estimates
for `eth_gasPrice` queries. Instead of returning the minimum gas price from
the recent blocks, the maximum of the median gas price from recent full
blocks is returned.  Additionally the gas oracle parameters are now
configurable, and the defaults are lowered to better detect full blocks.
@ptrus ptrus force-pushed the ptrus/fix/gas-price-oracle branch from 9aed169 to 9787497 Compare February 5, 2024 10:17
@ptrus ptrus enabled auto-merge February 5, 2024 10:21
@ptrus ptrus merged commit d321f9a into main Feb 5, 2024
6 checks passed
@ptrus ptrus deleted the ptrus/fix/gas-price-oracle branch February 5, 2024 10:21
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