From 07354b5513b13b9ff2bb7697b96c52050416a1e7 Mon Sep 17 00:00:00 2001 From: Dzung Do Date: Wed, 11 Dec 2024 19:09:09 +0700 Subject: [PATCH] fix validator updates --- modules/staking/utils_validators.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/staking/utils_validators.go b/modules/staking/utils_validators.go index 2c1c88ed5..1a5c0c438 100644 --- a/modules/staking/utils_validators.go +++ b/modules/staking/utils_validators.go @@ -3,6 +3,7 @@ package staking import ( "fmt" + "cosmossdk.io/math" "github.com/forbole/callisto/v4/modules/staking/keybase" "github.com/forbole/callisto/v4/types" @@ -251,11 +252,12 @@ func (m *Module) updateProposalValidatorStatusSnapshot( if err != nil { return err } + divisor, _ := math.NewIntFromString("1000000000000000000") snapshots[index] = types.NewProposalValidatorStatusSnapshot( proposalID, consAddr.String(), - validator.Tokens.Int64(), + validator.Tokens.Quo(divisor).Int64(), validator.Status, validator.Jailed, height, @@ -287,8 +289,8 @@ func (m *Module) updateValidatorStatusAndVP(height int64, validators []stakingty if err != nil { return err } - - votingPowers[index] = types.NewValidatorVotingPower(consAddr.String(), validator.Tokens.Int64(), height) + divisor, _ := math.NewIntFromString("1000000000000000000") + votingPowers[index] = types.NewValidatorVotingPower(consAddr.String(), validator.Tokens.Quo(divisor).Int64(), height) statuses[index] = types.NewValidatorStatus( consAddr.String(),