Use any as validator pubkey (#7597)
* protobuf pubkey type update * wip2 * wip3 * solving types.NewValidator issues * remove bech32 from validator type assignment * update Validator interface * Changelog update * wip4 * update genutil * fix simapp & x/ibc/testing tests * update staking * changelog update * fix import cycle in tests * fix amino panic on TestValidatorMarshalUnmarshalJSON * fix TestValidatorMarshalUnmarshalJSON consensus_pubkey check * Add UnpackInterfaces to HistoricalInfo * fix TestHistoricalInfo * update todos * fix: Expecting ed25519.PubKey to implement proto.Message * fix linter issues * Fix migrate test * Update CHANGELOG.md Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * review comments * cosmetic changes * add UnpackInterfaces got GenesisRandomized test * Validator.Equal reuses Validator.MinEqual * fix test * use Validator.Equal in tests * Fix staking simulation TestRandomizedGenState * Remove TODO * use HistoricalInfo.Equal * use proto.Equal * rename Validator.GetConsPubKey to TmConsPubKey * prefer require.Equal over reflect.DeepEqual * SetHistoricalInfo using a pointer * Fix TestQueryDelegation test * Fix TestQueryValidators test * Fix TestSimulateMsgUnjail test * experiement with LegacyAmino instances * Register codecs in all simapp tests * Fix cli_test compilation problems * fix typo sdk -> std * fix typo * fix TestPlanStringer * Rename to MakeEncodingConfig * Remove RegisterCodecsTests * Use gRPC in GetCmdQueryValidators * Empty status * fix info log check * linter fixes * rename simapparams to simappparams * Update simapp/test_helpers.go Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * comments updates * use valAddr1 instead of sdk.ValAddress(pk1.Address().Bytes()) Co-authored-by: Cory Levinson <cjlevinson@gmail.com> Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
This commit is contained in:
co-authored by
Marie Gauthier
Cory Levinson
Amaury Martiny
parent
5bebf2bd39
commit
6bc8ff2dfe
@@ -4,7 +4,6 @@ package cli_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
json "encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -277,9 +276,9 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidators() {
|
||||
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
|
||||
s.Require().NoError(err)
|
||||
|
||||
var result []types.Validator
|
||||
s.Require().NoError(json.Unmarshal(out.Bytes(), &result))
|
||||
s.Require().Equal(len(s.network.Validators), len(result))
|
||||
var result types.QueryValidatorsResponse
|
||||
s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), &result))
|
||||
s.Require().Equal(len(s.network.Validators), len(result.Validators))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,22 +113,21 @@ $ %s query staking validators
|
||||
return err
|
||||
}
|
||||
|
||||
resKVs, _, err := clientCtx.QuerySubspace(types.ValidatorsKey, types.StoreKey)
|
||||
queryClient := types.NewQueryClient(clientCtx)
|
||||
pageReq, err := client.ReadPageRequest(cmd.Flags())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var validators types.Validators
|
||||
for _, kv := range resKVs {
|
||||
validator, err := types.UnmarshalValidator(types.ModuleCdc, kv.Value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
validators = append(validators, validator)
|
||||
result, err := queryClient.Validators(context.Background(), &types.QueryValidatorsRequest{
|
||||
// Leaving status empty on purpose to query all validators.
|
||||
Pagination: pageReq,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintOutputLegacy(validators)
|
||||
return clientCtx.PrintOutput(result)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user