Skip to content
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

[R4R]-{develop}: fix gasoracle update frequency #1344

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions gas-oracle/oracle/gas_price_oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (g *GasPriceOracle) OverHeadLoop() {
db, height := readGasOracleSyncHeight()
log.Info("ReadGasOracleSyncHeight", "height", height)
// set channel
stateBatchAppendChan := make(chan *bindings.StateCommitmentChainStateBatchAppended, 10)
stateBatchAppendChan := make(chan *bindings.StateCommitmentChainStateBatchAppended, 1)

// set context
ctcTotalBatches, err := g.ctcBackend.GetTotalBatches(&bind.CallOpts{})
Expand Down Expand Up @@ -247,7 +247,10 @@ func (g *GasPriceOracle) OverHeadLoop() {
case stateBatchAppendChan <- iter.Event:
log.Info("write event into channel", "channel length is", len(stateBatchAppendChan))
default:
log.Error("write too many event into channel, increase channel length")
// discard additional event to process the last one
<-stateBatchAppendChan
stateBatchAppendChan <- iter.Event
log.Warn("write additional event into channel, will ignore prev events")
}
}
_ = writeGasOracleSyncHeight(db, latestHeader.Number)
Expand Down
6 changes: 5 additions & 1 deletion gas-oracle/oracle/overhead.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ func wrapUpdateOverhead(l2Backend DeployContractBackend, cfg *Config) (func(*big
if err != nil {
return err
}

// skip update if overhead is not changed
if overhead == newOverheadLevel {
log.Info("skip update overhead", "overhead", overhead)
Sha3nS marked this conversation as resolved.
Show resolved Hide resolved
return nil
}
// Use the configured gas price if it is set,
// otherwise use gas estimation
if cfg.gasPrice != nil {
Expand Down
Loading