From 00ab5c733c717f3d1fe389f8564d01e1359f87ca Mon Sep 17 00:00:00 2001 From: Matt Ketmo Date: Thu, 19 Oct 2023 11:58:00 +0200 Subject: [PATCH] fix: expose seat price as Near (#7) --- pkg/watcher/watcher.go | 2 +- pkg/watcher/watcher_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/watcher/watcher.go b/pkg/watcher/watcher.go index ce32993..f227242 100644 --- a/pkg/watcher/watcher.go +++ b/pkg/watcher/watcher.go @@ -163,7 +163,7 @@ func (w *Watcher) collectValidators(ctx context.Context) (near.ValidatorsRespons w.metrics.ValidatorSlashed.WithLabelValues(labels...).Set(metrics.BoolToFloat64(v.IsSlashed)) w.metrics.ValidatorStake.WithLabelValues(labels...).Set(v.Stake.Div(yoctoUnit).InexactFloat64()) - t := v.Stake.InexactFloat64() + t := v.Stake.Div(yoctoUnit).InexactFloat64() if seatPrice == 0 { seatPrice = t } diff --git a/pkg/watcher/watcher_test.go b/pkg/watcher/watcher_test.go index aae2af6..e0a248e 100644 --- a/pkg/watcher/watcher_test.go +++ b/pkg/watcher/watcher_test.go @@ -306,7 +306,7 @@ func TestWatcher(t *testing.T) { require.NoError(t, err) assert.Equal(t, float64(142256359), testutil.ToFloat64(metrics.EpochStartHeight)) - assert.Equal(t, float64(5048850744401447176504014136424), testutil.ToFloat64(metrics.SeatPrice)) + assert.Equal(t, float64(5048850.744401447176504014136424), testutil.ToFloat64(metrics.SeatPrice)) // ValidatorRank assert.Equal(t, 5, testutil.CollectAndCount(metrics.ValidatorRank))