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

Updating how eth_gasPrice is calculated #2176

Merged
merged 3 commits into from Dec 14, 2023
Merged

Conversation

asoto-iov
Copy link
Contributor

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

We are updating the logic about how the gas price data returned by the eth_gasPrice rpc method is calculated.

Description

The new behaviour is:

  1. We need to check isFeeMarketWorking() in the GasPriceTracker class to figure out if recent blocks are full enough. If the method returns true then go to the item 2 below. Otherwise, eth_gasPrice should return lastBestBlock.getMinimumGasPrice() * minGasPriceMultiplier , where minGasPriceMultiplier is a configuration value and should be 1.1 by default ( 10% increment of min gas price).

2.If a market is working (isFeeMarketWorking() returns true) , then eth_gasPrice should return same results as it returns right now (no changes in this case).

Motivation and Context

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:

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

class EthereumImplTest {

Check notice

Code scanning / CodeQL

Unused classes and interfaces Note

Unused class: EthereumImplTest is not referenced within this codebase. If not used as an external API it should be removed.
@asoto-iov
Copy link
Contributor Author

pipeline:run

rmoreliovlabs
rmoreliovlabs previously approved these changes Nov 15, 2023
Copy link
Contributor

@rmoreliovlabs rmoreliovlabs left a comment

Choose a reason for hiding this comment

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

LGTM

@asoto-iov
Copy link
Contributor Author

pipeline:run

2 similar comments
@asoto-iov
Copy link
Contributor Author

pipeline:run

@Vovchyk
Copy link
Contributor

Vovchyk commented Nov 16, 2023

pipeline:run

Copy link

sonarcloud bot commented Dec 14, 2023

@Vovchyk Vovchyk merged commit c53bc53 into master Dec 14, 2023
10 checks passed
@Vovchyk Vovchyk deleted the fix_eth_gasPrice_method branch December 14, 2023 14:18
@aeidelman aeidelman added this to the Fingerroot 5.4.0 milestone Jan 23, 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