Commit 6112b7aa authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #1255 from ethereum-optimism/gas-oracle/logging

gas-oracle: improve logging
parents 6ede0241 8c4f479c
---
'@eth-optimism/gas-oracle': patch
---
Add additional logging in the `gas-oracle`
......@@ -52,6 +52,8 @@ func (p *GasPricer) CalcNextEpochGasPrice(avgGasPerSecondLastEpoch float64) (uin
}
// The percent difference between our current average gas & our target gas
proportionOfTarget := avgGasPerSecondLastEpoch / targetGasPerSecond
log.Trace("Calculating next epoch gas price", "proportionOfTarget", proportionOfTarget,
"avgGasPerSecondLastEpoch", avgGasPerSecondLastEpoch, "targetGasPerSecond", targetGasPerSecond)
// The percent that we should adjust the gas price to reach our target gas
proportionToChangeBy := 0.0
if proportionOfTarget >= 1 { // If average avgGasPerSecondLastEpoch is GREATER than our target
......@@ -59,9 +61,11 @@ func (p *GasPricer) CalcNextEpochGasPrice(avgGasPerSecondLastEpoch float64) (uin
} else {
proportionToChangeBy = math.Max(proportionOfTarget, 1-p.maxChangePerEpoch)
}
log.Debug("CalcNextEpochGasPrice", "proportionToChangeBy", proportionToChangeBy, "proportionOfTarget", proportionOfTarget)
updated := float64(max(1, p.curPrice)) * proportionToChangeBy
return max(p.floorPrice, uint64(math.Ceil(updated))), nil
result := max(p.floorPrice, uint64(math.Ceil(updated)))
log.Debug("Calculated next epoch gas price", "proportionToChangeBy", proportionToChangeBy,
"proportionOfTarget", proportionOfTarget, "result", result)
return result, nil
}
// CompleteEpoch ends the current epoch and updates the current gas price for the next epoch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment