Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshvanahalli committed Jul 14, 2023
1 parent 823d927 commit aefc1b9
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions arbos/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,7 @@ func ProduceBlockAdvanced(
log.Debug("error applying transaction", "tx", tx, "err", err)
if !hooks.DiscardInvalidTxsEarly {
// we'll still deduct a TxGas's worth from the block-local rate limiter even if the tx was invalid
if blockGasLeft > params.TxGas {
blockGasLeft -= params.TxGas
} else {
blockGasLeft = 0
}
blockGasLeft = arbmath.SaturatingUSub(blockGasLeft, params.TxGas)
if isUserTx {
userTxsProcessed++
}
Expand Down Expand Up @@ -418,13 +414,9 @@ func ProduceBlockAdvanced(
}
}

if blockGasLeft > computeUsed {
blockGasLeft -= computeUsed
} else {
blockGasLeft = 0
}
blockGasLeft = arbmath.SaturatingUSub(blockGasLeft, computeUsed)

// add gas used since startup to prometheus metric
// Add gas used since startup to prometheus metric.
gasUsed := arbmath.SaturatingUSub(receipt.GasUsed, receipt.GasUsedForL1)
gasUsedSinceStartupCounter.Inc(arbmath.SaturatingCast(gasUsed))

Expand Down

0 comments on commit aefc1b9

Please sign in to comment.