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

[R4R]use fixed gas price when network is idle #35

Merged
merged 1 commit into from Nov 17, 2020
Merged

Conversation

unclezoro
Copy link
Collaborator

@unclezoro unclezoro commented Sep 6, 2020

Description

The defect of the previous implementation of gas-price oracle:
When the network is idle, one high gas price transaction may affect the result because of the lack of other transaction, and eventually cause others use high gas-pricce.

Improvement:

  1. When the network is idle: we use fixed gas-price as suggest gas-price.
  2. When the network is busy: use previous logic.

Once the number of txs in the last 20 blocks exceeds a threshold, we consider the network is busy.

Changes

Notable changes:
A new configure: GPO.OracleThreshold, default value is 0. It is a value we used to decide the network is busy or not.

Preflight checks

  • build passed (make build)
  • tests passed (make test)
  • manual transaction test passed

Related issues

@unclezoro unclezoro changed the title [R4R]use fixed gas price since bsc network is idle [R4R]use fixed gas price when network is idle Nov 16, 2020
abelliumnt
abelliumnt previously approved these changes Nov 16, 2020
yutianwu
yutianwu previously approved these changes Nov 16, 2020
@unclezoro unclezoro dismissed stale reviews from yutianwu and abelliumnt via f2e4965 November 16, 2020 12:36
@unclezoro unclezoro force-pushed the fixedGas branch 3 times, most recently from 7371524 to e0685dc Compare November 17, 2020 04:21
@@ -103,6 +109,7 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
sent := 0
exp := 0
var blockPrices []*big.Int
var totalSamples int
Copy link
Contributor

Choose a reason for hiding this comment

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

totalSamples -> totalTxSamples
sampleThreshold -> sampleTxsThreshold

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

resolved

@unclezoro unclezoro merged commit 1a50838 into master Nov 17, 2020
@unclezoro unclezoro deleted the fixedGas branch January 18, 2021 12:26
Pythonberg1997 pushed a commit to Pythonberg1997/bsc that referenced this pull request Sep 1, 2022
NashBC pushed a commit to NashBC/bsc that referenced this pull request Sep 28, 2022
zzzckck pushed a commit that referenced this pull request Mar 12, 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

3 participants