From f88bfa15427c8379ee1be1dd3063d2638b0db1a9 Mon Sep 17 00:00:00 2001 From: skosito Date: Wed, 4 Sep 2024 11:35:27 +0200 Subject: [PATCH] PR comment and bug fix with validators append --- precompiles/staking/staking.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/precompiles/staking/staking.go b/precompiles/staking/staking.go index e85a7719e1..308a1968f3 100644 --- a/precompiles/staking/staking.go +++ b/precompiles/staking/staking.go @@ -17,6 +17,7 @@ import ( ptypes "github.com/zeta-chain/node/precompiles/types" ) +// method names const ( // write StakeMethodName = "stake" @@ -128,13 +129,13 @@ func (c *Contract) GetAllValidators( validators := c.stakingKeeper.GetAllValidators(ctx) validatorsRes := make([]Validator, len(validators)) - for _, v := range validators { - validatorsRes = append(validatorsRes, Validator{ + for i, v := range validators { + validatorsRes[i] = Validator{ OperatorAddress: v.OperatorAddress, ConsensusPubKey: v.ConsensusPubkey.String(), BondStatus: uint8(v.Status), Jailed: v.Jailed, - }) + } } return method.Outputs.Pack(validatorsRes)