change TmService's validator pubkey type to any (#8060)

* change validator pubkey type to any

* add test for vslidator pubkey

* change address to string

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
This commit is contained in:
MD Aleem
2020-12-07 13:51:38 +00:00
committed by GitHub
co-authored by Jonathan Gimeno
parent 971d253214
commit d4a919b714
5 changed files with 187 additions and 148 deletions
+138 -128
View File
@@ -6,12 +6,13 @@ package tmservice
import (
context "context"
fmt "fmt"
types "github.com/cosmos/cosmos-sdk/codec/types"
query "github.com/cosmos/cosmos-sdk/types/query"
_ "github.com/gogo/protobuf/gogoproto"
grpc1 "github.com/gogo/protobuf/grpc"
proto "github.com/gogo/protobuf/proto"
p2p "github.com/tendermint/tendermint/proto/tendermint/p2p"
types "github.com/tendermint/tendermint/proto/tendermint/types"
types1 "github.com/tendermint/tendermint/proto/tendermint/types"
_ "google.golang.org/genproto/googleapis/api/annotations"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
@@ -258,10 +259,10 @@ func (m *GetLatestValidatorSetResponse) GetPagination() *query.PageResponse {
// Validator is the type for the validator-set.
type Validator struct {
Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
PubKey string `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"`
VotingPower int64 `protobuf:"varint,3,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"`
ProposerPriority int64 `protobuf:"varint,4,opt,name=proposer_priority,json=proposerPriority,proto3" json:"proposer_priority,omitempty"`
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
PubKey *types.Any `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"`
VotingPower int64 `protobuf:"varint,3,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"`
ProposerPriority int64 `protobuf:"varint,4,opt,name=proposer_priority,json=proposerPriority,proto3" json:"proposer_priority,omitempty"`
}
func (m *Validator) Reset() { *m = Validator{} }
@@ -297,18 +298,18 @@ func (m *Validator) XXX_DiscardUnknown() {
var xxx_messageInfo_Validator proto.InternalMessageInfo
func (m *Validator) GetAddress() []byte {
func (m *Validator) GetAddress() string {
if m != nil {
return m.Address
}
return nil
return ""
}
func (m *Validator) GetPubKey() string {
func (m *Validator) GetPubKey() *types.Any {
if m != nil {
return m.PubKey
}
return ""
return nil
}
func (m *Validator) GetVotingPower() int64 {
@@ -372,8 +373,8 @@ func (m *GetBlockByHeightRequest) GetHeight() int64 {
// GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight RPC method.
type GetBlockByHeightResponse struct {
BlockId *types.BlockID `protobuf:"bytes,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"`
Block *types.Block `protobuf:"bytes,2,opt,name=block,proto3" json:"block,omitempty"`
BlockId *types1.BlockID `protobuf:"bytes,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"`
Block *types1.Block `protobuf:"bytes,2,opt,name=block,proto3" json:"block,omitempty"`
}
func (m *GetBlockByHeightResponse) Reset() { *m = GetBlockByHeightResponse{} }
@@ -409,14 +410,14 @@ func (m *GetBlockByHeightResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_GetBlockByHeightResponse proto.InternalMessageInfo
func (m *GetBlockByHeightResponse) GetBlockId() *types.BlockID {
func (m *GetBlockByHeightResponse) GetBlockId() *types1.BlockID {
if m != nil {
return m.BlockId
}
return nil
}
func (m *GetBlockByHeightResponse) GetBlock() *types.Block {
func (m *GetBlockByHeightResponse) GetBlock() *types1.Block {
if m != nil {
return m.Block
}
@@ -462,8 +463,8 @@ var xxx_messageInfo_GetLatestBlockRequest proto.InternalMessageInfo
// GetLatestBlockResponse is the response type for the Query/GetLatestBlock RPC method.
type GetLatestBlockResponse struct {
BlockId *types.BlockID `protobuf:"bytes,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"`
Block *types.Block `protobuf:"bytes,2,opt,name=block,proto3" json:"block,omitempty"`
BlockId *types1.BlockID `protobuf:"bytes,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"`
Block *types1.Block `protobuf:"bytes,2,opt,name=block,proto3" json:"block,omitempty"`
}
func (m *GetLatestBlockResponse) Reset() { *m = GetLatestBlockResponse{} }
@@ -499,14 +500,14 @@ func (m *GetLatestBlockResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_GetLatestBlockResponse proto.InternalMessageInfo
func (m *GetLatestBlockResponse) GetBlockId() *types.BlockID {
func (m *GetLatestBlockResponse) GetBlockId() *types1.BlockID {
if m != nil {
return m.BlockId
}
return nil
}
func (m *GetLatestBlockResponse) GetBlock() *types.Block {
func (m *GetLatestBlockResponse) GetBlock() *types1.Block {
if m != nil {
return m.Block
}
@@ -865,72 +866,74 @@ func init() {
}
var fileDescriptor_40c93fb3ef485c5d = []byte{
// 1040 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
0x14, 0xcf, 0xc6, 0xad, 0x1d, 0x3f, 0x57, 0x90, 0x4c, 0x4a, 0xb3, 0xb5, 0x52, 0x37, 0xec, 0xa1,
0x4d, 0x88, 0xb2, 0x2b, 0x3b, 0x84, 0x82, 0xf8, 0x27, 0x85, 0x80, 0x1b, 0xb5, 0x54, 0xd1, 0x06,
0x71, 0x40, 0x48, 0xab, 0xb5, 0x77, 0xb2, 0x19, 0xc5, 0xde, 0x99, 0xee, 0x8c, 0x8d, 0x2c, 0x54,
0x81, 0xfa, 0x01, 0x10, 0x12, 0x5f, 0x81, 0x0b, 0x5f, 0x80, 0x23, 0xe2, 0xc8, 0x8d, 0x4a, 0x48,
0xd0, 0x23, 0x4a, 0xf8, 0x14, 0x9c, 0xd0, 0xce, 0xcc, 0xda, 0xbb, 0xcd, 0x1f, 0xdb, 0x39, 0x20,
0xf5, 0xe4, 0xd9, 0xf7, 0xde, 0xef, 0xcd, 0xef, 0xf7, 0x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f, 0x00, 0x00, 0xff, 0xff, 0x82, 0x6b, 0xb0, 0xbd, 0xc0, 0x0c, 0x00, 0x00,
// 1059 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcf, 0x6f, 0xdc, 0xc4,
0x17, 0x8f, 0xb3, 0x6d, 0x36, 0x79, 0xfb, 0xd5, 0x97, 0x64, 0x12, 0x1a, 0xc7, 0x4a, 0xb7, 0xc1,
0x87, 0x36, 0x21, 0x8a, 0xad, 0xdd, 0x10, 0x0a, 0xe2, 0x97, 0x08, 0x81, 0x34, 0x6a, 0xa9, 0x22,
0x07, 0x71, 0x40, 0x48, 0x96, 0x77, 0x3d, 0x71, 0x46, 0xd9, 0xf5, 0x4c, 0x3d, 0xe3, 0xa0, 0x15,
0xaa, 0x40, 0xfd, 0x0b, 0x90, 0xf8, 0x17, 0x7a, 0xe1, 0x1f, 0xe0, 0x88, 0x38, 0x72, 0xa3, 0x12,
0x12, 0xf4, 0x88, 0x12, 0xfe, 0x0a, 0x4e, 0xc8, 0x33, 0xe3, 0x5d, 0xbb, 0x49, 0xba, 0xbb, 0x39,
0x20, 0x71, 0xf2, 0xcc, 0xfb, 0x35, 0x9f, 0xcf, 0x9b, 0xf7, 0x9e, 0x07, 0x5e, 0x6f, 0x53, 0xde,
0xa5, 0xdc, 0x6d, 0x05, 0x1c, 0xbb, 0x02, 0xc7, 0x21, 0x4e, 0xba, 0x24, 0x16, 0xee, 0x49, 0xa3,
0x85, 0x45, 0xd0, 0x70, 0x1f, 0xa5, 0x38, 0xe9, 0x39, 0x2c, 0xa1, 0x82, 0xa2, 0xba, 0xb2, 0x75,
0x32, 0x5b, 0x67, 0x60, 0xeb, 0x68, 0x5b, 0x6b, 0x21, 0xa2, 0x11, 0x95, 0xa6, 0x6e, 0xb6, 0x52,
0x5e, 0xd6, 0x52, 0x44, 0x69, 0xd4, 0xc1, 0xae, 0xdc, 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, 0x47, 0x84,
0xff, 0xb5, 0xfa, 0xab, 0x3c, 0x46, 0xbf, 0x1a, 0x85, 0xb1, 0x5e, 0x7c, 0x09, 0xa0, 0x77, 0x47,
0xce, 0xe4, 0x05, 0x2f, 0x15, 0xeb, 0xbd, 0x2b, 0x7a, 0x6b, 0x3e, 0x6f, 0x4b, 0x3e, 0x9b, 0xa8,
0x31, 0x8c, 0xcf, 0xe0, 0x11, 0x91, 0x5f, 0xc9, 0x1f, 0x86, 0xfc, 0xb9, 0x5e, 0xf4, 0x3c, 0x44,
0xef, 0x8f, 0x80, 0xea, 0x25, 0x4f, 0x5b, 0xeb, 0x83, 0x2b, 0xfb, 0x6b, 0x5e, 0xef, 0x48, 0x5e,
0x5b, 0x68, 0x73, 0x0c, 0x5e, 0xf9, 0x5d, 0x6d, 0x3f, 0xf8, 0xe5, 0xb4, 0x6e, 0x3c, 0x3b, 0xad,
0x1b, 0x7f, 0x9e, 0xd6, 0x8d, 0xef, 0xce, 0xea, 0x13, 0xcf, 0xce, 0xea, 0x13, 0xcf, 0xcf, 0xea,
0x13, 0x5f, 0x34, 0x23, 0x22, 0x8e, 0xd2, 0x96, 0xd3, 0xa6, 0xdd, 0x3c, 0xb0, 0xfa, 0x6c, 0xf0,
0xf0, 0xd8, 0x6d, 0x77, 0x08, 0x8e, 0x85, 0x1b, 0x25, 0xac, 0xed, 0x8a, 0x2e, 0x57, 0x63, 0xac,
0x35, 0x25, 0x5f, 0x3a, 0x9b, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xf6, 0xf3, 0x0e, 0x76, 0xf1,
0x0c, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -1418,10 +1421,15 @@ func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x18
}
if len(m.PubKey) > 0 {
i -= len(m.PubKey)
copy(dAtA[i:], m.PubKey)
i = encodeVarintQuery(dAtA, i, uint64(len(m.PubKey)))
if m.PubKey != nil {
{
size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
@@ -1923,8 +1931,8 @@ func (m *Validator) Size() (n int) {
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.PubKey)
if l > 0 {
if m.PubKey != nil {
l = m.PubKey.Size()
n += 1 + l + sovQuery(uint64(l))
}
if m.VotingPower != 0 {
@@ -2618,40 +2626,6 @@ func (m *Validator) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...)
if m.Address == nil {
m.Address = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
@@ -2678,7 +2652,43 @@ func (m *Validator) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PubKey = string(dAtA[iNdEx:postIndex])
m.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.PubKey == nil {
m.PubKey = &types.Any{}
}
if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 0 {
@@ -2873,7 +2883,7 @@ func (m *GetBlockByHeightResponse) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.BlockId == nil {
m.BlockId = &types.BlockID{}
m.BlockId = &types1.BlockID{}
}
if err := m.BlockId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -2909,7 +2919,7 @@ func (m *GetBlockByHeightResponse) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Block == nil {
m.Block = &types.Block{}
m.Block = &types1.Block{}
}
if err := m.Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -3051,7 +3061,7 @@ func (m *GetLatestBlockResponse) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.BlockId == nil {
m.BlockId = &types.BlockID{}
m.BlockId = &types1.BlockID{}
}
if err := m.BlockId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -3087,7 +3097,7 @@ func (m *GetLatestBlockResponse) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Block == nil {
m.Block = &types.Block{}
m.Block = &types1.Block{}
}
if err := m.Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
+25 -4
View File
@@ -11,6 +11,7 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/rpc"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
qtypes "github.com/cosmos/cosmos-sdk/types/query"
"github.com/cosmos/cosmos-sdk/version"
)
@@ -22,6 +23,7 @@ type queryServer struct {
}
var _ ServiceServer = queryServer{}
var _ codectypes.UnpackInterfacesMessage = &GetLatestValidatorSetResponse{}
// NewQueryServer creates a new tendermint query server.
func NewQueryServer(clientCtx client.Context, interfaceRegistry codectypes.InterfaceRegistry) ServiceServer {
@@ -105,16 +107,31 @@ func (s queryServer) GetLatestValidatorSet(ctx context.Context, req *GetLatestVa
}
for i, validator := range validatorsRes.Validators {
anyPub, err := codectypes.NewAnyWithValue(validator.PubKey)
if err != nil {
return nil, err
}
outputValidatorsRes.Validators[i] = &Validator{
Address: validator.Address,
Address: validator.Address.String(),
ProposerPriority: validator.ProposerPriority,
PubKey: validator.PubKey,
PubKey: anyPub,
VotingPower: validator.VotingPower,
}
}
return outputValidatorsRes, nil
}
func (m *GetLatestValidatorSetResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
var pubKey cryptotypes.PubKey
for _, val := range m.Validators {
err := unpacker.UnpackAny(val.PubKey, &pubKey)
if err != nil {
return err
}
}
return nil
}
// GetValidatorSetByHeight implements ServiceServer.GetValidatorSetByHeight
func (s queryServer) GetValidatorSetByHeight(ctx context.Context, req *GetValidatorSetByHeightRequest) (*GetValidatorSetByHeightResponse, error) {
page, limit, err := qtypes.ParsePagination(req.Pagination)
@@ -142,10 +159,14 @@ func (s queryServer) GetValidatorSetByHeight(ctx context.Context, req *GetValida
}
for i, validator := range validatorsRes.Validators {
anyPub, err := codectypes.NewAnyWithValue(validator.PubKey)
if err != nil {
return nil, err
}
outputValidatorsRes.Validators[i] = &Validator{
Address: validator.Address,
Address: validator.Address.String(),
ProposerPriority: validator.ProposerPriority,
PubKey: validator.PubKey,
PubKey: anyPub,
VotingPower: validator.VotingPower,
}
}
+11 -1
View File
@@ -8,6 +8,8 @@ import (
"github.com/stretchr/testify/suite"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/testutil/network"
qtypes "github.com/cosmos/cosmos-sdk/types/query"
"github.com/cosmos/cosmos-sdk/types/rest"
@@ -98,10 +100,14 @@ func (s IntegrationTestSuite) TestQueryLatestValidatorSet() {
val := s.network.Validators[0]
// nil pagination
_, err := s.queryClient.GetLatestValidatorSet(context.Background(), &tmservice.GetLatestValidatorSetRequest{
res, err := s.queryClient.GetLatestValidatorSet(context.Background(), &tmservice.GetLatestValidatorSetRequest{
Pagination: nil,
})
s.Require().NoError(err)
s.Require().Equal(1, len(res.Validators))
content, ok := res.Validators[0].PubKey.GetCachedValue().(cryptotypes.PubKey)
s.Require().Equal(true, ok)
s.Require().Equal(content, val.PubKey)
//with pagination
_, err = s.queryClient.GetLatestValidatorSet(context.Background(), &tmservice.GetLatestValidatorSetRequest{Pagination: &qtypes.PageRequest{
@@ -119,6 +125,10 @@ func (s IntegrationTestSuite) TestQueryLatestValidatorSet() {
s.Require().NoError(err)
var validatorSetRes tmservice.GetLatestValidatorSetResponse
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(restRes, &validatorSetRes))
s.Require().Equal(1, len(validatorSetRes.Validators))
anyPub, err := codectypes.NewAnyWithValue(val.PubKey)
s.Require().NoError(err)
s.Require().Equal(validatorSetRes.Validators[0].PubKey, anyPub)
}
func (s IntegrationTestSuite) TestQueryValidatorSetByHeight() {
+8 -11
View File
@@ -15,6 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/rest"
)
@@ -66,10 +67,10 @@ func ValidatorCommand() *cobra.Command {
// Validator output in bech32 format
type ValidatorOutput struct {
Address sdk.ConsAddress `json:"address"`
PubKey string `json:"pub_key"`
ProposerPriority int64 `json:"proposer_priority"`
VotingPower int64 `json:"voting_power"`
Address sdk.ConsAddress `json:"address"`
PubKey cryptotypes.PubKey `json:"pub_key"`
ProposerPriority int64 `json:"proposer_priority"`
VotingPower int64 `json:"voting_power"`
}
// Validators at a certain height output in bech32 format
@@ -99,19 +100,15 @@ func (rvo ResultValidatorsOutput) String() string {
return b.String()
}
func bech32ValidatorOutput(validator *tmtypes.Validator) (ValidatorOutput, error) {
func validatorOutput(validator *tmtypes.Validator) (ValidatorOutput, error) {
pk, err := cryptocodec.FromTmPubKeyInterface(validator.PubKey)
if err != nil {
return ValidatorOutput{}, err
}
bechValPubkey, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, pk)
if err != nil {
return ValidatorOutput{}, err
}
return ValidatorOutput{
Address: sdk.ConsAddress(validator.Address),
PubKey: bechValPubkey,
PubKey: pk,
ProposerPriority: validator.ProposerPriority,
VotingPower: validator.VotingPower,
}, nil
@@ -136,7 +133,7 @@ func GetValidators(clientCtx client.Context, height *int64, page, limit *int) (R
}
for i := 0; i < len(validatorsRes.Validators); i++ {
outputValidatorsRes.Validators[i], err = bech32ValidatorOutput(validatorsRes.Validators[i])
outputValidatorsRes.Validators[i], err = validatorOutput(validatorsRes.Validators[i])
if err != nil {
return ResultValidatorsOutput{}, err
}