Skip to content

feat: suggest gas price based on latest block's transactions #291

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

Merged
merged 23 commits into from
Jul 31, 2025

Conversation

yiweichi
Copy link
Member

This PR focus on implementing a simplified version of the GPO without needing to look at the tx pool, however look at the status of latest block. Suggest gas price base on if the latest block is at capacity. this will help to:

  • reduce node configuration complexity by removing congestion threshold parameter
  • reduce RPC node overhead by removing expensive query of tx pool size
  • enable private mempool while any RPC node is still able to provide reasonable gas price estimate

Two JSON_RPC methods are effected.

  1. eth_gasPrice, if the latest block is not at capacity, this will return a minimal suggest gas price.
  2. eth_feeHistory, if the latest block is not at capacity, the reward field of return will be the minimal suggest gas price.

Copy link

codspeed-hq bot commented Jul 27, 2025

CodSpeed Performance Report

Merging #291 will not alter performance

Comparing feat-simplify-gas-price-oracle (50e096e) with scroll (357655f)

Summary

✅ 77 untouched benchmarks

Copy link
Collaborator

@frisitano frisitano left a comment

Choose a reason for hiding this comment

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

I will leave review of the logic to @jonastheis and @greged93 who have better gas oracle related context. However, I wonder if we can avoid making changes to crates/rpc/rpc-eth-types/src/gas_oracle.rs and instead exclusively use overrides in crates/scroll/* code? Our objective is to minimise our fork diff with upstream.

@yiweichi
Copy link
Member Author

I will leave review of the logic to @jonastheis and @greged93 who have better gas oracle related context. However, I wonder if we can avoid making changes to crates/rpc/rpc-eth-types/src/gas_oracle.rs and instead exclusively use overrides in crates/scroll/* code? Our objective is to minimise our fork diff with upstream.

Yes, that's a good one. I tried to keep crates/rpc/rpc-eth-types/src/gas_oracle.rs as is or make as less changes as possible, but can't find a good way to do so. Mainly because GasPriceOracle on Reth is a struct instead of a trait, seems hard to override it on crates/scroll/*.
@greged93 may I ask any input on this?

Copy link
Collaborator

@greged93 greged93 left a comment

Choose a reason for hiding this comment

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

couple of comments but looks good!

@greged93
Copy link
Collaborator

@greged93 may I ask any input on this?

It looks a little tricky yes, upstream would need to abstract the GasOracle, right now I don't really see any solution.

Base automatically changed from feat-add-max-da-block-size to scroll July 28, 2025 14:12
Copy link
Collaborator

@greged93 greged93 left a comment

Choose a reason for hiding this comment

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

noticed some default values that I think need to be updated.

Copy link
Collaborator

@greged93 greged93 left a comment

Choose a reason for hiding this comment

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

Couple of small comments and questions, I think we can merge after this!

Copy link
Collaborator

@greged93 greged93 left a comment

Choose a reason for hiding this comment

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

lgtm!

@yiweichi yiweichi merged commit d6f52ad into scroll Jul 31, 2025
43 checks passed
@yiweichi yiweichi deleted the feat-simplify-gas-price-oracle branch July 31, 2025 07:00
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.

4 participants