-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add buffer to gasPrices on Arbitrum estimator #8449
Conversation
// the block's base fee. If the base fee increases rapidly there is a chance the suggested gas price will fall under that value, resulting in a fee too low error. | ||
// We use gasPriceWithBuffer to increase the estimated gas price by some percentage to avoid fee too low errors. Eventually, only the base fee will be paid, regardless of the price. | ||
func (a *arbitrumEstimator) gasPriceWithBuffer(gasPrice *assets.Wei, maxGasPriceWei *assets.Wei) *assets.Wei { | ||
gasPrice = gasPrice.AddPercentage(25) |
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.
@prashantkumar1982 we could potentially make the 25% value configurable, although I'm a bit worried about having an ENV var that is specifically dedicated to 1 chain.
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 think its ok not to have it be configurable, but can it be at least in a named constant?
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
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.
Change looks good.
However this should definitely cause the unit-tests to fail. You will need to fix them.
Also add 1 more test-case where maxGasPriceWei is lower than 25% buffer, so we ensure the final max is equal to the limit.
Yes this is a draft PR. I just wanted to align on whether we should use a configurable percentage or not. |
// the block's base fee. If the base fee increases rapidly there is a chance the suggested gas price will fall under that value, resulting in a fee too low error. | ||
// We use gasPriceWithBuffer to increase the estimated gas price by some percentage to avoid fee too low errors. Eventually, only the base fee will be paid, regardless of the price. | ||
func (a *arbitrumEstimator) gasPriceWithBuffer(gasPrice *assets.Wei, maxGasPriceWei *assets.Wei) *assets.Wei { | ||
gasPrice = gasPrice.AddPercentage(25) |
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 think its ok not to have it be configurable, but can it be at least in a named constant?
100185d
to
6d5e9bd
Compare
ac6cff1
to
f2bd2ab
Compare
// the block's base fee. If the base fee increases rapidly there is a chance the suggested gas price will fall under that value, resulting in a fee too low error. | ||
// We use gasPriceWithBuffer to increase the estimated gas price by some percentage to avoid fee too low errors. Eventually, only the base fee will be paid, regardless of the price. | ||
func (a *arbitrumEstimator) gasPriceWithBuffer(gasPrice *assets.Wei, maxGasPriceWei *assets.Wei) *assets.Wei { | ||
const gasPriceBufferPercentage = 25 |
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.
Thinking more about it.
Could we bump up the buffer to 100%?
It still only requires wallet to hold funds good enough for 2 txs, doesn't sound too much.
we anyways will not pay that, so no harm being generous here.
It will also help avoid Low Fee error more easily.
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 don't like bumping to 100% because that would mean we completely mask the problem. Since this is an Arbitrum issue, we need to draw the line somewhere and say "Ok, a certain percentage is somewhat understandable, but if the RPC suggests estimations that are more than 25% off, then this should be fixed on their end". Maybe we could reach up to 50% if we feel it's acceptable.
f2bd2ab
to
5b996ed
Compare
5b996ed
to
ee3a66f
Compare
No description provided.