mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-06 13:26:23 +00:00
keys: change to []bytes (#4950)
This commit is contained in:
@@ -1090,7 +1090,7 @@ func (data *EvidenceData) StringIndented(indent string) string {
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
// BlockID defines the unique ID of a block as its Hash and its PartSetHeader
|
||||
// BlockID
|
||||
type BlockID struct {
|
||||
Hash tmbytes.HexBytes `json:"hash"`
|
||||
PartsHeader PartSetHeader `json:"parts"`
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto" // nolint: staticcheck // still used by gogoproto
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/tendermint/tendermint/types/proto3"
|
||||
|
||||
@@ -209,24 +209,24 @@ func (pb2tm) PubKey(pubKey abci.PubKey) (crypto.PubKey, error) {
|
||||
return nil, fmt.Errorf("invalid size for PubKeyEd25519. Got %d, expected %d",
|
||||
len(pubKey.Data), ed25519.PubKeySize)
|
||||
}
|
||||
var pk ed25519.PubKey
|
||||
copy(pk[:], pubKey.Data)
|
||||
var pk = make(ed25519.PubKey, ed25519.PubKeySize)
|
||||
copy(pk, pubKey.Data)
|
||||
return pk, nil
|
||||
case ABCIPubKeyTypeSr25519:
|
||||
if len(pubKey.Data) != sr25519.PubKeySize {
|
||||
return nil, fmt.Errorf("invalid size for PubKeySr25519. Got %d, expected %d",
|
||||
len(pubKey.Data), sr25519.PubKeySize)
|
||||
}
|
||||
var pk sr25519.PubKey
|
||||
copy(pk[:], pubKey.Data)
|
||||
var pk = make(sr25519.PubKey, sr25519.PubKeySize)
|
||||
copy(pk, pubKey.Data)
|
||||
return pk, nil
|
||||
case ABCIPubKeyTypeSecp256k1:
|
||||
if len(pubKey.Data) != secp256k1.PubKeySize {
|
||||
return nil, fmt.Errorf("invalid size for PubKeySecp256k1. Got %d, expected %d",
|
||||
len(pubKey.Data), secp256k1.PubKeySize)
|
||||
}
|
||||
var pk secp256k1.PubKey
|
||||
copy(pk[:], pubKey.Data)
|
||||
var pk = make(secp256k1.PubKey, secp256k1.PubKeySize)
|
||||
copy(pk, pubKey.Data)
|
||||
return pk, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown pubkey type %v", pubKey.Type)
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/proto" // nolint: staticcheck // still used by gogoproto
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
|
||||
@@ -360,9 +360,9 @@ func newValidator(address []byte, power int64) *Validator {
|
||||
}
|
||||
|
||||
func randPubKey() crypto.PubKey {
|
||||
var pubKey [32]byte
|
||||
copy(pubKey[:], tmrand.Bytes(32))
|
||||
return ed25519.PubKey(pubKey)
|
||||
pubKey := make(ed25519.PubKey, ed25519.PubKeySize)
|
||||
copy(pubKey, tmrand.Bytes(32))
|
||||
return ed25519.PubKey(tmrand.Bytes(32))
|
||||
}
|
||||
|
||||
func randValidator(totalVotingPower int64) *Validator {
|
||||
|
||||
Reference in New Issue
Block a user