eth: Set tx GasFeeCap to min(gasPriceEstimate, current GasFeeCap) #2583
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this pull request do? Explain your changes. (required)
At the moment, if the
-maxGasPrice
flag is used theGasFeeCap
for all txs is also set to themaxGasPrice
value. TheGasFeeCap
serves as the maximum fee/price that will be charged per unit of gas consumed by a tx. The minimum balance of an account is thegas used by the tx * GasFeeCap
. IfGasFeeCap
exceeds the actual gas price that is required for txs then a refund will be provided to the account based on the difference betweenGasFeeCap
and the actual gas price. But, if the account does not have enough balance covergas used by the tx * GasFeeCap
then anInsufficient funds...
error will be encountered.In #2574, some O operators set a value for
-maxGasPrice
that is quite a bit higher than the actual average gas price paid on Arbitrum (i.e. ~0.1 gwei). As a result, even though their account balances could cover a tx based on the actual gas price paid, their account balances could not cover a tx based onGasFeeCap = maxGasPrice
. The current available workarounds are to either top off account balances to ensure the balance can covergas * GasFeeCap
(with the excess fee refunded to the balance at the end of the successful tx), set a lower value for-maxGasPrice
or stop using the-maxGasPrice
flag.I felt that while there are available workarounds, the way the
-maxGasPrice
flag currently works is a bit weird since it can easily lead to a node operator thinking they are just being safe by setting a high value for-maxGasPrice
, but then having that high value cause tx issues if they do not have super high account balances. So, I opted to modify theGasFeeCap
of txs tomin(gasPriceEstimate, current GasFeeCap
wheregasPriceEstimate = baseFee * 2
so that in these cases a node operator doesn't run into tx issues.See in-line code comments for more details.
Specific updates (required)
See commit history.
How did you test each of these updates (required)
Tested on Arbitrum Rinkeby:
Ran a node off the master branch
Used
livepeer_cli
to set maxGasPrice = 300 gweiInvoked a LPT transfer and observed an
insufficient funds...
errorRestarted the node running off of the branch for this PR
Used
livepeer_cli
to set maxGasPrice = 300 gweiInvoked a LPT transfer and observed a successful tx.
Does this pull request close any open issues?
Fixes #2574
Checklist:
make
runs successfully./test.sh
pass