From 730ca74e443949643bbc13f9f68b24792864b793 Mon Sep 17 00:00:00 2001 From: Jinsuk Park Date: Wed, 14 Aug 2024 20:56:26 +0900 Subject: [PATCH 1/3] metrics: count transactions by source --- op-node/rollup/derive/engine_update.go | 2 ++ ops-bedrock/docker-compose.yml | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/op-node/rollup/derive/engine_update.go b/op-node/rollup/derive/engine_update.go index 1da430b926d0..a98071302f39 100644 --- a/op-node/rollup/derive/engine_update.go +++ b/op-node/rollup/derive/engine_update.go @@ -229,6 +229,7 @@ func confirmPayload( metrics.RecordSequencerProfit(float64(WeiToGwei(builderPayload.envelope.BlockValue)), opMetrics.PayloadSourceBuilder) metrics.RecordSequencerPayloadInserted(opMetrics.PayloadSourceBuilder) metrics.RecordPayloadGas(float64(builderPayload.envelope.ExecutionPayload.GasUsed), opMetrics.PayloadSourceBuilder) + metrics.CountSequencedTxsBySource(len(builderPayload.envelope.ExecutionPayload.Transactions), opMetrics.PayloadSourceBuilder) log.Info("succeessfully inserted payload from builder") return builderPayload.envelope, errTyp, err } @@ -238,6 +239,7 @@ func confirmPayload( metrics.RecordSequencerProfit(float64(WeiToGwei(engineEnvelope.BlockValue)), opMetrics.PayloadSourceEngine) metrics.RecordSequencerPayloadInserted(opMetrics.PayloadSourceEngine) metrics.RecordPayloadGas(float64(engineEnvelope.ExecutionPayload.GasUsed), opMetrics.PayloadSourceEngine) + metrics.CountSequencedTxsBySource(len(engineEnvelope.ExecutionPayload.Transactions), opMetrics.PayloadSourceEngine) errType, err := insertPayload(ctx, log, eng, fc, updateSafe, agossip, sequencerConductor, engineEnvelope) return engineEnvelope, errType, err } diff --git a/ops-bedrock/docker-compose.yml b/ops-bedrock/docker-compose.yml index 9e7a863ed06d..51ae5592d5c4 100644 --- a/ops-bedrock/docker-compose.yml +++ b/ops-bedrock/docker-compose.yml @@ -327,7 +327,6 @@ services: - "--builder.seconds_in_slot=2" - "--builder.block_resubmit_interval=200ms" - "--builder.submission_offset=1s" - - "--verbosity=5" environment: GETH_MINER_RECOMMIT: 100ms BUILDER_TX_SIGNING_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" From 1b909f45fc9bbf1009d872d9227b4fc103db43dd Mon Sep 17 00:00:00 2001 From: Jinsuk Park Date: Wed, 14 Aug 2024 21:09:33 +0900 Subject: [PATCH 2/3] add 'total' postfix to TransactionsSequenced --- op-node/metrics/metrics.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/op-node/metrics/metrics.go b/op-node/metrics/metrics.go index 60f771f9a89e..5c100cb122eb 100644 --- a/op-node/metrics/metrics.go +++ b/op-node/metrics/metrics.go @@ -145,8 +145,8 @@ type Metrics struct { L1ReorgDepth prometheus.Histogram - TransactionsSequencedTotal prometheus.Counter - TransactionsSequenced *prometheus.CounterVec + TransactionsSequencedTotal prometheus.Counter + TransactionsSequencedSourceTotal *prometheus.CounterVec PlasmaMetrics plasma.Metricer @@ -253,9 +253,9 @@ func NewMetrics(procName string) *Metrics { Name: "transactions_sequenced_total", Help: "Count of total transactions sequenced", }), - TransactionsSequenced: factory.NewCounterVec(prometheus.CounterOpts{ + TransactionsSequencedSourceTotal: factory.NewCounterVec(prometheus.CounterOpts{ Namespace: ns, - Name: "transactions_sequenced", + Name: "transactions_sequenced_source_total", Help: "Count of transactions sequenced by sources", }, []string{ "source", @@ -551,7 +551,7 @@ func (m *Metrics) CountSequencedTxs(count int) { } func (m *Metrics) CountSequencedTxsBySource(count int, source string) { - m.TransactionsSequenced.WithLabelValues(source).Add(float64(count)) + m.TransactionsSequencedSourceTotal.WithLabelValues(source).Add(float64(count)) } func (m *Metrics) RecordL1ReorgDepth(d uint64) { From 468e30bb0005c072d38dac44361c5572dad11104 Mon Sep 17 00:00:00 2001 From: Jinsuk Park Date: Thu, 15 Aug 2024 00:42:44 +0900 Subject: [PATCH 3/3] measure gas usage of builder and engine payloads --- op-node/rollup/derive/engine_update.go | 24 +++++++++++++++--------- ops-bedrock/docker-compose.yml | 1 + 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/op-node/rollup/derive/engine_update.go b/op-node/rollup/derive/engine_update.go index a98071302f39..144990bd956f 100644 --- a/op-node/rollup/derive/engine_update.go +++ b/op-node/rollup/derive/engine_update.go @@ -222,24 +222,30 @@ func confirmPayload( return nil, BlockInsertTemporaryErr, fmt.Errorf("failed to get execution payload from engine: %w", err) } } + metrics.RecordSequencerProfit(float64(WeiToGwei(engineEnvelope.BlockValue)), opMetrics.PayloadSourceEngine) + metrics.RecordPayloadGas(float64(engineEnvelope.ExecutionPayload.GasUsed), opMetrics.PayloadSourceEngine) + metrics.CountSequencedTxsBySource(len(engineEnvelope.ExecutionPayload.Transactions), opMetrics.PayloadSourceEngine) if builderPayload != nil && builderPayload.success { - errTyp, err := insertPayload(ctx, log, eng, fc, updateSafe, agossip, sequencerConductor, builderPayload.envelope) - if errTyp == BlockInsertOK { + if builderPayload.envelope.ExecutionPayload.GasUsed >= engineEnvelope.ExecutionPayload.GasUsed { + log.Info("builder payload has higher gas usage than engine payload", "builder_gas", builderPayload.envelope.ExecutionPayload.GasUsed, "engine_gas", engineEnvelope.ExecutionPayload.GasUsed) metrics.RecordSequencerProfit(float64(WeiToGwei(builderPayload.envelope.BlockValue)), opMetrics.PayloadSourceBuilder) - metrics.RecordSequencerPayloadInserted(opMetrics.PayloadSourceBuilder) metrics.RecordPayloadGas(float64(builderPayload.envelope.ExecutionPayload.GasUsed), opMetrics.PayloadSourceBuilder) metrics.CountSequencedTxsBySource(len(builderPayload.envelope.ExecutionPayload.Transactions), opMetrics.PayloadSourceBuilder) - log.Info("succeessfully inserted payload from builder") - return builderPayload.envelope, errTyp, err + + errTyp, err := insertPayload(ctx, log, eng, fc, updateSafe, agossip, sequencerConductor, builderPayload.envelope) + if errTyp == BlockInsertOK { + metrics.RecordSequencerPayloadInserted(opMetrics.PayloadSourceBuilder) + log.Info("succeessfully inserted payload from builder") + return builderPayload.envelope, errTyp, err + } + log.Error("failed to insert payload from builder", "errType", errTyp, "error", err) + } else { + log.Warn("builder payload has lower gas usage than engine payload", "builder_gas", builderPayload.envelope.ExecutionPayload.GasUsed, "engine_gas", engineEnvelope.ExecutionPayload.GasUsed) } - log.Error("failed to insert payload from builder", "errType", errTyp, "error", err) } - metrics.RecordSequencerProfit(float64(WeiToGwei(engineEnvelope.BlockValue)), opMetrics.PayloadSourceEngine) metrics.RecordSequencerPayloadInserted(opMetrics.PayloadSourceEngine) - metrics.RecordPayloadGas(float64(engineEnvelope.ExecutionPayload.GasUsed), opMetrics.PayloadSourceEngine) - metrics.CountSequencedTxsBySource(len(engineEnvelope.ExecutionPayload.Transactions), opMetrics.PayloadSourceEngine) errType, err := insertPayload(ctx, log, eng, fc, updateSafe, agossip, sequencerConductor, engineEnvelope) return engineEnvelope, errType, err } diff --git a/ops-bedrock/docker-compose.yml b/ops-bedrock/docker-compose.yml index 51ae5592d5c4..af898ae92c49 100644 --- a/ops-bedrock/docker-compose.yml +++ b/ops-bedrock/docker-compose.yml @@ -327,6 +327,7 @@ services: - "--builder.seconds_in_slot=2" - "--builder.block_resubmit_interval=200ms" - "--builder.submission_offset=1s" + - "--builder.algotype=greedy" environment: GETH_MINER_RECOMMIT: 100ms BUILDER_TX_SIGNING_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"