Skip to content

Commit

Permalink
Merge pull request #2214 from OffchainLabs/prefetcher-gas-used
Browse files Browse the repository at this point in the history
Don't increment the gas used metric in the prefetcher
  • Loading branch information
joshuacolvin0 authored Apr 1, 2024
2 parents fc0feea + 564c462 commit 61b98c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 0 additions & 6 deletions arbos/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
)
Expand All @@ -40,7 +39,6 @@ var L2ToL1TransactionEventID common.Hash
var L2ToL1TxEventID common.Hash
var EmitReedeemScheduledEvent func(*vm.EVM, uint64, uint64, [32]byte, [32]byte, common.Address, *big.Int, *big.Int) error
var EmitTicketCreatedEvent func(*vm.EVM, [32]byte) error
var gasUsedSinceStartupCounter = metrics.NewRegisteredCounter("arb/gas_used", nil)

// A helper struct that implements String() by marshalling to JSON.
// This is useful for logging because it's lazy, so if the log level is too high to print the transaction,
Expand Down Expand Up @@ -463,10 +461,6 @@ func ProduceBlockAdvanced(

blockGasLeft = arbmath.SaturatingUSub(blockGasLeft, computeUsed)

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

complete = append(complete, tx)
receipts = append(receipts, receipt)

Expand Down
10 changes: 6 additions & 4 deletions execution/gethexec/executionengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ import (
)

var (
baseFeeGauge = metrics.NewRegisteredGauge("arb/block/basefee", nil)
blockGasUsedHistogram = metrics.NewRegisteredHistogram("arb/block/gasused", nil, metrics.NewBoundedHistogramSample())
txCountHistogram = metrics.NewRegisteredHistogram("arb/block/transactions/count", nil, metrics.NewBoundedHistogramSample())
txGasUsedHistogram = metrics.NewRegisteredHistogram("arb/block/transactions/gasused", nil, metrics.NewBoundedHistogramSample())
baseFeeGauge = metrics.NewRegisteredGauge("arb/block/basefee", nil)
blockGasUsedHistogram = metrics.NewRegisteredHistogram("arb/block/gasused", nil, metrics.NewBoundedHistogramSample())
txCountHistogram = metrics.NewRegisteredHistogram("arb/block/transactions/count", nil, metrics.NewBoundedHistogramSample())
txGasUsedHistogram = metrics.NewRegisteredHistogram("arb/block/transactions/gasused", nil, metrics.NewBoundedHistogramSample())
gasUsedSinceStartupCounter = metrics.NewRegisteredCounter("arb/gas_used", nil)
)

type ExecutionEngine struct {
Expand Down Expand Up @@ -513,6 +514,7 @@ func (s *ExecutionEngine) appendBlock(block *types.Block, statedb *state.StateDB
blockGasused += val
}
blockGasUsedHistogram.Update(int64(blockGasused))
gasUsedSinceStartupCounter.Inc(int64(blockGasused))
return nil
}

Expand Down

0 comments on commit 61b98c8

Please sign in to comment.