From 48c5611840778e449c1ea5750fddd3e8f490ecae Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Fri, 29 Sep 2023 13:56:02 +0800 Subject: [PATCH 1/5] feat(rollup): add block commit calldata size --- .../internal/controller/watcher/l2_watcher.go | 3 +++ .../controller/watcher/l2_watcher_metrics.go | 17 +++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/rollup/internal/controller/watcher/l2_watcher.go b/rollup/internal/controller/watcher/l2_watcher.go index 8cd5cd00a0..347633e3dc 100644 --- a/rollup/internal/controller/watcher/l2_watcher.go +++ b/rollup/internal/controller/watcher/l2_watcher.go @@ -180,6 +180,9 @@ func (w *L2WatcherClient) getAndStoreBlockTraces(ctx context.Context, from, to u } if len(blocks) > 0 { + for _, block := range blocks { + w.metrics.rollupL2BlockL1CommitCalldataSize.Set(float64(block.EstimateL1CommitCalldataSize())) + } if err := w.l2BlockOrm.InsertL2Blocks(w.ctx, blocks); err != nil { return fmt.Errorf("failed to batch insert BlockTraces: %v", err) } diff --git a/rollup/internal/controller/watcher/l2_watcher_metrics.go b/rollup/internal/controller/watcher/l2_watcher_metrics.go index 627382349d..ba76d12157 100644 --- a/rollup/internal/controller/watcher/l2_watcher_metrics.go +++ b/rollup/internal/controller/watcher/l2_watcher_metrics.go @@ -8,12 +8,13 @@ import ( ) type l2WatcherMetrics struct { - fetchRunningMissingBlocksTotal prometheus.Counter - fetchRunningMissingBlocksHeight prometheus.Gauge - fetchContractEventTotal prometheus.Counter - fetchContractEventHeight prometheus.Gauge - rollupL2MsgsRelayedEventsTotal prometheus.Counter - rollupL2BlocksFetchedGap prometheus.Gauge + fetchRunningMissingBlocksTotal prometheus.Counter + fetchRunningMissingBlocksHeight prometheus.Gauge + fetchContractEventTotal prometheus.Counter + fetchContractEventHeight prometheus.Gauge + rollupL2MsgsRelayedEventsTotal prometheus.Counter + rollupL2BlocksFetchedGap prometheus.Gauge + rollupL2BlockL1CommitCalldataSize prometheus.Gauge } var ( @@ -48,6 +49,10 @@ func initL2WatcherMetrics(reg prometheus.Registerer) *l2WatcherMetrics { Name: "rollup_l2_watcher_blocks_fetched_gap", Help: "The gap of l2 fetch", }), + rollupL2BlockL1CommitCalldataSize: promauto.With(reg).NewGauge(prometheus.GaugeOpts{ + Name: "rollup_l2_block_commit_calldata_size", + Help: "The l2 block commit calldata size", + }), } }) return l2WatcherMetric From 2d2b7d424d889eef77263ca379a12efa5c10d506 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Fri, 29 Sep 2023 05:58:16 +0000 Subject: [PATCH 2/5] =?UTF-8?q?chore:=20auto=20version=20bump=E2=80=89[bot?= =?UTF-8?q?]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/version/version.go b/common/version/version.go index 5250033b3a..d39dd5823a 100644 --- a/common/version/version.go +++ b/common/version/version.go @@ -5,7 +5,7 @@ import ( "runtime/debug" ) -var tag = "v4.3.26" +var tag = "v4.3.27" var commit = func() string { if info, ok := debug.ReadBuildInfo(); ok { From 1f6adbabcf87f2f183dea5d374da8c08d84246ed Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Fri, 29 Sep 2023 14:00:11 +0800 Subject: [PATCH 3/5] tweak description --- rollup/internal/controller/watcher/l2_watcher_metrics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rollup/internal/controller/watcher/l2_watcher_metrics.go b/rollup/internal/controller/watcher/l2_watcher_metrics.go index ba76d12157..7375d12e50 100644 --- a/rollup/internal/controller/watcher/l2_watcher_metrics.go +++ b/rollup/internal/controller/watcher/l2_watcher_metrics.go @@ -50,8 +50,8 @@ func initL2WatcherMetrics(reg prometheus.Registerer) *l2WatcherMetrics { Help: "The gap of l2 fetch", }), rollupL2BlockL1CommitCalldataSize: promauto.With(reg).NewGauge(prometheus.GaugeOpts{ - Name: "rollup_l2_block_commit_calldata_size", - Help: "The l2 block commit calldata size", + Name: "rollup_l2_block_l1_commit_calldata_size", + Help: "The l1 commitBatch calldata size of the l2 block", }), } }) From dc1c7180afffb0ba8cfc2cae97f916ac604ea8cf Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Fri, 29 Sep 2023 15:12:42 +0800 Subject: [PATCH 4/5] add commit/finalize batch tx revert metrics --- rollup/internal/controller/relayer/l2_relayer.go | 2 ++ .../internal/controller/relayer/l2_relayer_metrics.go | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/rollup/internal/controller/relayer/l2_relayer.go b/rollup/internal/controller/relayer/l2_relayer.go index 7bdeb0e8a1..440d72c260 100644 --- a/rollup/internal/controller/relayer/l2_relayer.go +++ b/rollup/internal/controller/relayer/l2_relayer.go @@ -582,6 +582,7 @@ func (r *Layer2Relayer) handleConfirmation(confirmation *sender.Confirmation) { status = types.RollupCommitted } else { status = types.RollupCommitFailed + r.metrics.rollupL2BatchesCommittedConfirmedFailedTotal.Inc() log.Warn("transaction confirmed but failed in layer1", "confirmation", confirmation) } // @todo handle db error @@ -603,6 +604,7 @@ func (r *Layer2Relayer) handleConfirmation(confirmation *sender.Confirmation) { status = types.RollupFinalized } else { status = types.RollupFinalizeFailed + r.metrics.rollupL2BatchesFinalizedConfirmedFailedTotal.Inc() log.Warn("transaction confirmed but failed in layer1", "confirmation", confirmation) } diff --git a/rollup/internal/controller/relayer/l2_relayer_metrics.go b/rollup/internal/controller/relayer/l2_relayer_metrics.go index 012a167f87..3ad71c684b 100644 --- a/rollup/internal/controller/relayer/l2_relayer_metrics.go +++ b/rollup/internal/controller/relayer/l2_relayer_metrics.go @@ -16,7 +16,9 @@ type l2RelayerMetrics struct { rollupL2RelayerProcessCommittedBatchesFinalizedTotal prometheus.Counter rollupL2RelayerProcessCommittedBatchesFinalizedSuccessTotal prometheus.Counter rollupL2BatchesCommittedConfirmedTotal prometheus.Counter + rollupL2BatchesCommittedConfirmedFailedTotal prometheus.Counter rollupL2BatchesFinalizedConfirmedTotal prometheus.Counter + rollupL2BatchesFinalizedConfirmedFailedTotal prometheus.Counter rollupL2BatchesGasOraclerConfirmedTotal prometheus.Counter rollupL2ChainMonitorLatestFailedCall prometheus.Counter rollupL2ChainMonitorLatestFailedBatchStatus prometheus.Counter @@ -62,10 +64,18 @@ func initL2RelayerMetrics(reg prometheus.Registerer) *l2RelayerMetrics { Name: "rollup_layer2_process_committed_batches_confirmed_total", Help: "The total number of layer2 process committed batches confirmed total", }), + rollupL2BatchesCommittedConfirmedFailedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{ + Name: "rollup_layer2_process_committed_batches_confirmed_failed_total", + Help: "The total number of layer2 process committed batches confirmed failed total", + }), rollupL2BatchesFinalizedConfirmedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{ Name: "rollup_layer2_process_finalized_batches_confirmed_total", Help: "The total number of layer2 process finalized batches confirmed total", }), + rollupL2BatchesFinalizedConfirmedFailedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{ + Name: "rollup_layer2_process_finalized_batches_confirmed_failed_total", + Help: "The total number of layer2 process finalized batches confirmed failed total", + }), rollupL2BatchesGasOraclerConfirmedTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{ Name: "rollup_layer2_process_gras_oracler_confirmed_total", Help: "The total number of layer2 process finalized batches confirmed total", From e60f31a45a1a791e6955f88f5f593b9044b7623a Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Fri, 29 Sep 2023 15:24:57 +0800 Subject: [PATCH 5/5] tweak logs --- rollup/internal/controller/relayer/l2_relayer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rollup/internal/controller/relayer/l2_relayer.go b/rollup/internal/controller/relayer/l2_relayer.go index 440d72c260..d1600b55c1 100644 --- a/rollup/internal/controller/relayer/l2_relayer.go +++ b/rollup/internal/controller/relayer/l2_relayer.go @@ -583,7 +583,7 @@ func (r *Layer2Relayer) handleConfirmation(confirmation *sender.Confirmation) { } else { status = types.RollupCommitFailed r.metrics.rollupL2BatchesCommittedConfirmedFailedTotal.Inc() - log.Warn("transaction confirmed but failed in layer1", "confirmation", confirmation) + log.Warn("commitBatch transaction confirmed but failed in layer1", "confirmation", confirmation) } // @todo handle db error err := r.batchOrm.UpdateCommitTxHashAndRollupStatus(r.ctx, batchHash.(string), confirmation.TxHash.String(), status) @@ -605,7 +605,7 @@ func (r *Layer2Relayer) handleConfirmation(confirmation *sender.Confirmation) { } else { status = types.RollupFinalizeFailed r.metrics.rollupL2BatchesFinalizedConfirmedFailedTotal.Inc() - log.Warn("transaction confirmed but failed in layer1", "confirmation", confirmation) + log.Warn("finalizeBatchWithProof transaction confirmed but failed in layer1", "confirmation", confirmation) } // @todo handle db error