-
Notifications
You must be signed in to change notification settings - Fork 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
[Enhancement] Add Gas Price Oracle User Configuration #4362
Conversation
Mainnet Release Candidate 4.3.14-rc3 (dev -> main)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update test TestHarmonyFlags
as well.
cmd/harmony/flags.go
Outdated
} | ||
gasPriceOracleMaxPriceGweiFlag = cli.IntFlag{ | ||
Name: "gpo.maxprice", | ||
Usage: "Maximum possible gas price in gwei returned by eth_gasPrice (default: 12)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is max gas price (12) < default gas price (100) ?
cmd/harmony/flags_test.go
Outdated
Percentile: 80, | ||
DefaultPriceGwei: 100, | ||
MaxPriceGwei: 12, | ||
NumberTxsSampled: 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refer to the values here instead of hard coding them.
cmd/harmony/main.go
Outdated
@@ -803,6 +803,9 @@ func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfi | |||
Uint64("viewID", viewID). | |||
Msg("Init Blockchain") | |||
|
|||
// Assign GasPriceOracle parameters to the current node | |||
currentNode.HarmonyConfig.GasPriceOracle = hc.GasPriceOracle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't see why this is needed. The currentNode
stores within itself the entire config (including the GasPriceOracle
) per below.
Line 1043 in b2e50e6
node.HarmonyConfig = harmonyconfig |
@@ -71,6 +71,7 @@ require ( | |||
github.com/c2h5oh/datasize v0.0.0-20220606134207-859f65c6625b | |||
github.com/ledgerwatch/erigon-lib v0.0.0-20221218022306-0f8fdd40c2db | |||
github.com/ledgerwatch/log/v3 v3.6.0 | |||
github.com/libp2p/go-libp2p-core v0.20.1 | |||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's preferred not to commit go.mod
and go.sum
for minor changes.
"updated", | ||
DefaultGasPriceOracleConfig.NumberTxsSampled, | ||
), | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a sanity check for maxPrice
< defaultPrice
@@ -387,7 +387,7 @@ func (hmy *Harmony) GetValidatorInformation( | |||
// b.apiCache.Forget(prevKey) | |||
|
|||
// calculate last APRHistoryLength epochs for averaging APR | |||
// epochFrom := bc.GasPriceConfig().StakingEpoch | |||
// epochFrom := bc.GasPriceOracleConfig().StakingEpoch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undo this change.
hmy/hmy.go
Outdated
Default: big.NewInt(100e9), // minimum of 100 gwei | ||
} | ||
gpoParams := nodeAPI.GetHarmonyConfig().GasPriceOracle | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Remove this blank line.
A few merge conflicts after a rebase. |
Fixed the merge conflicts for you. |
If a contract self destructs to self and then receives funds within the same transaction, it is possible for its stale state to be saved. This change removes that possibility by checking for deleted state objects before returning them.
New dev. Needs mentorship. Closed |
This change makes the gas price oracle options available as options in the configuration file / command line. In addition, the gas price oracle's suggestion mechanism has been modified to return the default gas price when block utilization is low. In other words, the oracle can be configured to return the 60th percentile gas price from the last 5 blocks with 3 transactions each, or return the default gas price if those 5 blocks were utilized less than 50% of their capacity Fixes harmony-one#4357 and supersedes harmony-one#4362
This change makes the gas price oracle options available as options in the configuration file / command line. In addition, the gas price oracle's suggestion mechanism has been modified to return the default gas price when block utilization is low. In other words, the oracle can be configured to return the 60th percentile gas price from the last 5 blocks with 3 transactions each, or return the default gas price if those 5 blocks were utilized less than 50% of their capacity Fixes #4357 and supersedes #4362
Issue
#4357 Add feature to enable users to specify gas price parameters (blocks, percentile, defaultPriceGwei, maxPriceGwei, and numberTxsnSampled) in config and as flags.
Test
Unit Test Coverage
Before:
After:
Test/Run Logs
Operational Checklist
Does this PR introduce backward-incompatible changes to the on-disk data structure and/or the over-the-wire protocol?. (If no, skip to question 8.)
NO
Describe the migration plan.. For each flag epoch, describe what changes take place at the flag epoch, the anticipated interactions between upgraded/non-upgraded nodes, and any special operational considerations for the migration.
Describe how the plan was tested.
How much minimum baking period after the last flag epoch should we allow on Pangaea before promotion onto mainnet?
What are the planned flag epoch numbers and their ETAs on Pangaea?
What are the planned flag epoch numbers and their ETAs on mainnet?
Note that this must be enough to cover baking period on Pangaea.
What should node operators know about this planned change?
Does this PR introduce backward-incompatible changes NOT related to on-disk data structure and/or over-the-wire protocol? (If no, continue to question 11.)
NO
Does the existing
node.sh
continue to work with this change?What should node operators know about this change?
Does this PR introduce significant changes to the operational requirements of the node software, such as >20% increase in CPU, memory, and/or disk usage?
NO
TODO