Commit edbf338e authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #2358 from ethereum-optimism/feat/gpo-configurable-base-fee-poll-interval

gas-oracle: allow configurable base fee poll interval
parents 3b82da3e c535b3a5
---
'@eth-optimism/gas-oracle': patch
---
Allow configurable base fee update poll time with `GAS_PRICE_ORACLE_L1_BASE_FEE_EPOCH_LENGTH_SECONDS`
......@@ -89,6 +89,12 @@ var (
Usage: "length of epochs in seconds",
EnvVar: "GAS_PRICE_ORACLE_EPOCH_LENGTH_SECONDS",
}
L1BaseFeeEpochLengthSecondsFlag = cli.Uint64Flag{
Name: "l1-base-fee-epoch-length-seconds",
Value: 15,
Usage: "polling time for updating the L1 base fee",
EnvVar: "GAS_PRICE_ORACLE_L1_BASE_FEE_EPOCH_LENGTH_SECONDS",
}
L1BaseFeeSignificanceFactorFlag = cli.Float64Flag{
Name: "l1-base-fee-significant-factor",
Value: 0.10,
......@@ -169,6 +175,7 @@ var Flags = []cli.Flag{
MaxPercentChangePerEpochFlag,
AverageBlockGasLimitPerEpochFlag,
EpochLengthSecondsFlag,
L1BaseFeeEpochLengthSecondsFlag,
L2GasPriceSignificanceFactorFlag,
WaitForReceiptFlag,
EnableL1BaseFeeFlag,
......
......@@ -28,6 +28,7 @@ type Config struct {
maxPercentChangePerEpoch float64
averageBlockGasLimitPerEpoch uint64
epochLengthSeconds uint64
l1BaseFeeEpochLengthSeconds uint64
l2GasPriceSignificanceFactor float64
l1BaseFeeSignificanceFactor float64
enableL1BaseFee bool
......@@ -54,6 +55,7 @@ func NewConfig(ctx *cli.Context) *Config {
cfg.maxPercentChangePerEpoch = ctx.GlobalFloat64(flags.MaxPercentChangePerEpochFlag.Name)
cfg.averageBlockGasLimitPerEpoch = ctx.GlobalUint64(flags.AverageBlockGasLimitPerEpochFlag.Name)
cfg.epochLengthSeconds = ctx.GlobalUint64(flags.EpochLengthSecondsFlag.Name)
cfg.l1BaseFeeEpochLengthSeconds = ctx.GlobalUint64(flags.L1BaseFeeEpochLengthSecondsFlag.Name)
cfg.l2GasPriceSignificanceFactor = ctx.GlobalFloat64(flags.L2GasPriceSignificanceFactorFlag.Name)
cfg.floorPrice = ctx.GlobalUint64(flags.FloorPriceFlag.Name)
cfg.l1BaseFeeSignificanceFactor = ctx.GlobalFloat64(flags.L1BaseFeeSignificanceFactorFlag.Name)
......
......@@ -111,6 +111,7 @@ func (g *GasPriceOracle) ensure() error {
func (g *GasPriceOracle) Loop() {
timer := time.NewTicker(time.Duration(g.config.epochLengthSeconds) * time.Second)
defer timer.Stop()
for {
select {
case <-timer.C:
......@@ -126,7 +127,7 @@ func (g *GasPriceOracle) Loop() {
}
func (g *GasPriceOracle) BaseFeeLoop() {
timer := time.NewTicker(15 * time.Second)
timer := time.NewTicker(time.Duration(g.config.l1BaseFeeEpochLengthSeconds) * time.Second)
defer timer.Stop()
updateBaseFee, err := wrapUpdateBaseFee(g.l1Backend, g.l2Backend, g.config)
......
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