From cd4e40dd477895746843021732a1beba14fa248a Mon Sep 17 00:00:00 2001 From: David Date: Thu, 8 Jun 2023 15:22:00 +0800 Subject: [PATCH] feat(metrics): add `ProverNormalProofRewardGauge` metrics (#275) --- metrics/metrics.go | 3 ++- prover/prover.go | 13 +++++++++++-- version/version.go | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/metrics/metrics.go b/metrics/metrics.go index a534a36e7..b3633f737 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -42,7 +42,8 @@ var ( ProverSentInvalidProofCounter = metrics.NewRegisteredCounter("prover/proof/invalid/sent", nil) ProverReceivedProposedBlockGauge = metrics.NewRegisteredGauge("prover/proposed/received", nil) ProverReceivedProvenBlockGauge = metrics.NewRegisteredGauge("prover/proven/received", nil) - ProverProofRewardGauge = metrics.NewRegisteredGauge("prover/proofReward", nil) + ProverAllProofRewardGauge = metrics.NewRegisteredGauge("prover/allProofReward", nil) + ProverNormalProofRewardGauge = metrics.NewRegisteredGauge("prover/normalProofReward", nil) ) // Serve starts the metrics server on the given address, will be closed when the given diff --git a/prover/prover.go b/prover/prover.go index 2717b2c22..ca8a2d74e 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -455,10 +455,19 @@ func (p *Prover) submitProofOp(ctx context.Context, proofWithHeader *proofProduc // the block being proven if it's verified. func (p *Prover) onBlockVerified(ctx context.Context, event *bindings.TaikoL1ClientBlockVerified) error { metrics.ProverLatestVerifiedIDGauge.Update(event.Id.Int64()) + + isNormalProof := p.protocolConfigs.RealProofSkipSize == nil || + (p.protocolConfigs.RealProofSkipSize != nil && event.Id.Uint64()%p.protocolConfigs.RealProofSkipSize.Uint64() == 0) if event.Reward > math.MaxInt64 { - metrics.ProverProofRewardGauge.Update(math.MaxInt64) + metrics.ProverAllProofRewardGauge.Update(math.MaxInt64) + if isNormalProof { + metrics.ProverNormalProofRewardGauge.Update(math.MaxInt64) + } } else { - metrics.ProverProofRewardGauge.Update(int64(event.Reward)) + metrics.ProverAllProofRewardGauge.Update(int64(event.Reward)) + if isNormalProof { + metrics.ProverNormalProofRewardGauge.Update(int64(event.Reward)) + } } p.latestVerifiedL1Height = event.Raw.BlockNumber diff --git a/version/version.go b/version/version.go index 14da14081..3c511f245 100644 --- a/version/version.go +++ b/version/version.go @@ -2,7 +2,7 @@ package version // Version info. var ( - Version = "0.9.0" + Version = "0.10.0" Meta = "dev" )