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

Commit

Permalink
feat(driver): add proof reward metric (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Jun 8, 2023
1 parent ffcfb53 commit 1e00560
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions driver/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"fmt"
"math"
"math/big"
"sync/atomic"

Expand Down Expand Up @@ -173,6 +174,11 @@ func (s *State) startSubscriptions(ctx context.Context) {
}
case e := <-s.blockVerifiedCh:
log.Info("📈 Block verified", "blockID", e.Id, "hash", common.Hash(e.BlockHash), "reward", e.Reward)
if e.Reward > math.MaxInt64 {
metrics.DriverProofRewardGauge.Update(math.MaxInt64)
} else {
metrics.DriverProofRewardGauge.Update(int64(e.Reward))
}
case e := <-s.crossChainSynced:
// Verify the protocol synced block, check if it exists in
// L2 execution engine.
Expand Down
1 change: 1 addition & 0 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var (
DriverL1CurrentHeightGauge = metrics.NewRegisteredGauge("driver/l1Current/height", nil)
DriverL2HeadIDGauge = metrics.NewRegisteredGauge("driver/l2Head/id", nil)
DriverL2VerifiedHeightGauge = metrics.NewRegisteredGauge("driver/l2Verified/id", nil)
DriverProofRewardGauge = metrics.NewRegisteredGauge("driver/proofReward", nil)

// Proposer
ProposerProposeEpochCounter = metrics.NewRegisteredCounter("proposer/epoch", nil)
Expand Down

0 comments on commit 1e00560

Please sign in to comment.