Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(metrics): add ProverNormalProofRewardGauge metrics (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Jun 8, 2023
1 parent 4b4e3fe commit cd4e40d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions prover/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package version

// Version info.
var (
Version = "0.9.0"
Version = "0.10.0"
Meta = "dev"
)

Expand Down

0 comments on commit cd4e40d

Please sign in to comment.