diff --git a/beacon-chain/db/kv/validators.go b/beacon-chain/db/kv/validators.go index a7d0e7c84..be7b4d770 100644 --- a/beacon-chain/db/kv/validators.go +++ b/beacon-chain/db/kv/validators.go @@ -1,7 +1,6 @@ package kv import ( - "bytes" "context" "encoding/binary" "time" @@ -99,12 +98,8 @@ func (k *Store) ValidatorIndex(ctx context.Context, publicKey [48]byte) (uint64, if enc == nil { return nil } - var err error - buf := bytes.NewBuffer(enc) - validatorIdx, err = binary.ReadUvarint(buf) - if err != nil { - return err - } + validatorIdx = binary.LittleEndian.Uint64(enc) + ok = true return nil }) diff --git a/beacon-chain/rpc/beacon_chain_server.go b/beacon-chain/rpc/beacon_chain_server.go index b1c7b56be..f5c8c4670 100644 --- a/beacon-chain/rpc/beacon_chain_server.go +++ b/beacon-chain/rpc/beacon_chain_server.go @@ -279,7 +279,7 @@ func (bs *BeaconChainServer) ListValidatorBalances( return nil, status.Errorf(codes.Internal, "could not retrieve validator index: %v", err) } if !ok { - return nil, status.Errorf(codes.Internal, "could validator index for public key %#x not found", pubKey) + return nil, status.Errorf(codes.Internal, "could not find validator index for public key %#x not found", pubKey) } } @@ -400,7 +400,7 @@ func (bs *BeaconChainServer) ListValidatorAssignments( return nil, status.Errorf(codes.Internal, "could not retrieve validator index: %v", err) } if !ok { - return nil, status.Errorf(codes.Internal, "could validator index for public key %#x not found", pubKey) + return nil, status.Errorf(codes.Internal, "could not find validator index for public key %#x not found", pubKey) } } diff --git a/beacon-chain/rpc/validator_server.go b/beacon-chain/rpc/validator_server.go index 344f99da4..e62c64e06 100644 --- a/beacon-chain/rpc/validator_server.go +++ b/beacon-chain/rpc/validator_server.go @@ -95,7 +95,7 @@ func (vs *ValidatorServer) ValidatorIndex(ctx context.Context, req *pb.Validator return nil, status.Errorf(codes.Internal, "could not retrieve validator index: %v", err) } if !ok { - return nil, status.Errorf(codes.Internal, "could validator index for public key %#x not found", req.PublicKey) + return nil, status.Errorf(codes.Internal, "could not find validator index for public key %#x not found", req.PublicKey) } } return &pb.ValidatorIndexResponse{Index: uint64(index)}, nil @@ -125,7 +125,7 @@ func (vs *ValidatorServer) ValidatorPerformance( return nil, status.Errorf(codes.Internal, "could not retrieve validator index: %v", err) } if !ok { - return nil, status.Errorf(codes.Internal, "could validator index for public key %#x not found", req.PublicKey) + return nil, status.Errorf(codes.Internal, "could not find validator index for public key %#x not found", req.PublicKey) } headState = vs.chainService.(blockchain.HeadRetriever).HeadState() @@ -238,7 +238,7 @@ func (vs *ValidatorServer) assignment( return nil, status.Errorf(codes.Internal, "could not retrieve validator index: %v", err) } if !ok { - return nil, status.Errorf(codes.Internal, "could validator index for public key %#x not found", pubkey) + return nil, status.Errorf(codes.Internal, "could not find validator index for public key %#x not found", pubkey) } }