core,pm: handle zero/nil gas price from gas price monitor #1830
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)
When the gas price monitor returns a gas price of
0
ornil
in on-chain mode the node will crash with a division-by-zero error. This bug caused a majority of the orchestrators on the public network to all crash simultaneously when a common hosted ethereum provider, infura, could have potentially returned a gas price of0
. (see below).Specific updates (required)
recipient.txCost()
if thegasPriceMonitor
returns0
(ornil
, but this should be impossible due to the above update)txCost
will return0
recipient.TxCostMultiplier()
if the value returned fromrecipient.txCost()
is0
, returnbig.NewRat(0,1)
orchestrator.priceInfo()
if thetxCostMultiplier
return fromrecipient.TxCostMultiplier()
is0/1
use a price multiplier of1
(no overhead charged because of no tx cost).How did you test each of these updates (required)
Motivation
Decided to add extra checks to deal with cases of
nil
and0
values down the call chain. While this is a more elaborate fix it would prevent breaking the software on private networks with a gas price of 0 or running against an ethereum node that also mines with a gas price of 0.Checklist:
make
runs successfully./test.sh
passContext