diff --git a/pkg/generators/signing_info.go b/pkg/generators/signing_info.go index 28c5a41..7a1c24e 100644 --- a/pkg/generators/signing_info.go +++ b/pkg/generators/signing_info.go @@ -4,7 +4,6 @@ import ( "main/pkg/constants" fetchersPkg "main/pkg/fetchers" statePkg "main/pkg/state" - "main/pkg/utils" "github.com/prometheus/client_golang/prometheus" ) @@ -34,7 +33,7 @@ func (g *SigningInfoGenerator) Generate(state *statePkg.State) []prometheus.Coll for chain, commissions := range data.SigningInfos { for validator, signingInfo := range commissions { - missedBlocksCounter := utils.StrToInt64(signingInfo.ValSigningInfo.MissedBlocksCounter) + missedBlocksCounter := signingInfo.ValSigningInfo.MissedBlocksCounter.Int64() if missedBlocksCounter >= 0 { missedBlocksGauge.With(prometheus.Labels{ "chain": chain, diff --git a/pkg/generators/signing_info_test.go b/pkg/generators/signing_info_test.go index 1740f67..6908a80 100644 --- a/pkg/generators/signing_info_test.go +++ b/pkg/generators/signing_info_test.go @@ -7,6 +7,8 @@ import ( "main/pkg/types" "testing" + "cosmossdk.io/math" + "github.com/stretchr/testify/assert" ) @@ -28,7 +30,7 @@ func TestSigningInfoGeneratorNotEmptyState(t *testing.T) { "chain": { "validator": &types.SigningInfoResponse{ ValSigningInfo: types.SigningInfo{ - MissedBlocksCounter: "100", + MissedBlocksCounter: math.NewInt(100), }, }, }, diff --git a/pkg/generators/slashing_params.go b/pkg/generators/slashing_params.go index 781bb05..bff627b 100644 --- a/pkg/generators/slashing_params.go +++ b/pkg/generators/slashing_params.go @@ -4,7 +4,6 @@ import ( "main/pkg/constants" fetchersPkg "main/pkg/fetchers" statePkg "main/pkg/state" - "main/pkg/utils" "github.com/prometheus/client_golang/prometheus" ) @@ -35,7 +34,7 @@ func (g *SlashingParamsGenerator) Generate(state *statePkg.State) []prometheus.C for chain, params := range data.Params { blocksWindowGauge.With(prometheus.Labels{ "chain": chain, - }).Set(float64(utils.StrToInt64(params.SlashingParams.SignedBlocksWindow))) + }).Set(float64(params.SlashingParams.SignedBlocksWindow.Int64())) } return []prometheus.Collector{blocksWindowGauge} diff --git a/pkg/generators/slashing_params_test.go b/pkg/generators/slashing_params_test.go index 4bc793a..05b8b46 100644 --- a/pkg/generators/slashing_params_test.go +++ b/pkg/generators/slashing_params_test.go @@ -7,6 +7,8 @@ import ( "main/pkg/types" "testing" + "cosmossdk.io/math" + "github.com/stretchr/testify/assert" ) @@ -27,7 +29,7 @@ func TestSlashingParamsGeneratorNotEmptyState(t *testing.T) { Params: map[string]*types.SlashingParamsResponse{ "chain": { SlashingParams: types.SlashingParams{ - SignedBlocksWindow: "100", + SignedBlocksWindow: math.NewInt(100), }, }, }, diff --git a/pkg/types/tendermint.go b/pkg/types/tendermint.go index a3d2c99..64d51b2 100644 --- a/pkg/types/tendermint.go +++ b/pkg/types/tendermint.go @@ -4,6 +4,8 @@ import ( "main/pkg/constants" "main/pkg/utils" "time" + + "cosmossdk.io/math" ) type ValidatorResponse struct { @@ -84,7 +86,7 @@ type SigningInfo struct { IndexOffset string `json:"index_offset"` JailedUntil time.Time `json:"jailed_until"` Tombstoned bool `json:"tombstoned"` - MissedBlocksCounter string `json:"missed_blocks_counter"` + MissedBlocksCounter math.Int `json:"missed_blocks_counter"` } type SigningInfoResponse struct { @@ -98,7 +100,7 @@ type AssignedKeyResponse struct { } type SlashingParams struct { - SignedBlocksWindow string `json:"signed_blocks_window"` + SignedBlocksWindow math.Int `json:"signed_blocks_window"` } type SlashingParamsResponse struct {