diff --git a/abci/example/kvstore/kvstore_test.go b/abci/example/kvstore/kvstore_test.go index ef678d40c..bc6303479 100644 --- a/abci/example/kvstore/kvstore_test.go +++ b/abci/example/kvstore/kvstore_test.go @@ -1,7 +1,6 @@ package kvstore import ( - "bytes" "fmt" "io/ioutil" "sort" @@ -220,7 +219,7 @@ func valsEqual(t *testing.T, vals1, vals2 []types.ValidatorUpdate) { sort.Sort(types.ValidatorUpdates(vals2)) for i, v1 := range vals1 { v2 := vals2[i] - if !bytes.Equal(v1.PubKey.Data, v2.PubKey.Data) || + if !v1.PubKey.Equal(v2.PubKey) || v1.Power != v2.Power { t.Fatalf("vals dont match at index %d. got %X/%d , expected %X/%d", i, v2.PubKey, v2.Power, v1.PubKey, v1.Power) } diff --git a/abci/example/kvstore/persistent_kvstore.go b/abci/example/kvstore/persistent_kvstore.go index 15765c1b8..b2e0da99b 100644 --- a/abci/example/kvstore/persistent_kvstore.go +++ b/abci/example/kvstore/persistent_kvstore.go @@ -11,8 +11,9 @@ import ( "github.com/tendermint/tendermint/abci/example/code" "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/ed25519" + cryptoenc "github.com/tendermint/tendermint/crypto/encoding" "github.com/tendermint/tendermint/libs/log" + pc "github.com/tendermint/tendermint/proto/crypto/keys" tmtypes "github.com/tendermint/tendermint/types" ) @@ -30,7 +31,7 @@ type PersistentKVStoreApplication struct { // validator set ValUpdates []types.ValidatorUpdate - valAddrToPubKeyMap map[string]types.PubKey + valAddrToPubKeyMap map[string]pc.PublicKey logger log.Logger } @@ -46,7 +47,7 @@ func NewPersistentKVStoreApplication(dbDir string) *PersistentKVStoreApplication return &PersistentKVStoreApplication{ app: &Application{state: state}, - valAddrToPubKeyMap: make(map[string]types.PubKey), + valAddrToPubKeyMap: make(map[string]pc.PublicKey), logger: log.NewNopLogger(), } } @@ -136,6 +137,7 @@ func (app *PersistentKVStoreApplication) BeginBlock(req types.RequestBeginBlock) }) } } + return types.ResponseBeginBlock{} } @@ -185,8 +187,12 @@ func (app *PersistentKVStoreApplication) Validators() (validators []types.Valida return } -func MakeValSetChangeTx(pubkey types.PubKey, power int64) []byte { - pubStr := base64.StdEncoding.EncodeToString(pubkey.Data) +func MakeValSetChangeTx(pubkey pc.PublicKey, power int64) []byte { + pk, err := cryptoenc.PubKeyFromProto(pubkey) + if err != nil { + panic(err) + } + pubStr := base64.StdEncoding.EncodeToString(pk.Bytes()) return []byte(fmt.Sprintf("val:%s!%d", pubStr, power)) } @@ -230,10 +236,11 @@ func (app *PersistentKVStoreApplication) execValidatorTx(tx []byte) types.Respon // add, update, or remove a validator func (app *PersistentKVStoreApplication) updateValidator(v types.ValidatorUpdate) types.ResponseDeliverTx { - key := []byte("val:" + string(v.PubKey.Data)) - - pubkey := make(ed25519.PubKey, ed25519.PubKeySize) - copy(pubkey, v.PubKey.Data) + key := []byte("val:" + string(v.PubKey.GetEd25519())) + pubkey, err := cryptoenc.PubKeyFromProto(v.PubKey) + if err != nil { + panic(fmt.Errorf("can't decode public key: %w", err)) + } if v.Power == 0 { // remove validator @@ -242,7 +249,7 @@ func (app *PersistentKVStoreApplication) updateValidator(v types.ValidatorUpdate panic(err) } if !hasKey { - pubStr := base64.StdEncoding.EncodeToString(v.PubKey.Data) + pubStr := base64.StdEncoding.EncodeToString(pubkey.Bytes()) return types.ResponseDeliverTx{ Code: code.CodeTypeUnauthorized, Log: fmt.Sprintf("Cannot remove non-existent validator %s", pubStr)} diff --git a/abci/types/pubkey.go b/abci/types/pubkey.go index 46cd8c5e8..aaff6debb 100644 --- a/abci/types/pubkey.go +++ b/abci/types/pubkey.go @@ -1,16 +1,24 @@ package types +import ( + "github.com/tendermint/tendermint/crypto/ed25519" + cryptoenc "github.com/tendermint/tendermint/crypto/encoding" +) + const ( PubKeyEd25519 = "ed25519" ) -func Ed25519ValidatorUpdate(pubkey []byte, power int64) ValidatorUpdate { +func Ed25519ValidatorUpdate(pk []byte, power int64) ValidatorUpdate { + pke := ed25519.PubKey(pk) + pkp, err := cryptoenc.PubKeyToProto(pke) + if err != nil { + panic(err) + } + return ValidatorUpdate{ // Address: - PubKey: PubKey{ - Type: PubKeyEd25519, - Data: pubkey, - }, - Power: power, + PubKey: pkp, + Power: power, } } diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index d2427b504..c207b24e1 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -10,6 +10,7 @@ import ( proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "github.com/golang/protobuf/ptypes/timestamp" + keys "github.com/tendermint/tendermint/proto/crypto/keys" merkle "github.com/tendermint/tendermint/proto/crypto/merkle" types "github.com/tendermint/tendermint/proto/types" grpc "google.golang.org/grpc" @@ -2926,8 +2927,8 @@ func (m *Validator) GetPower() int64 { // ValidatorUpdate type ValidatorUpdate struct { - PubKey PubKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` - Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` + PubKey keys.PublicKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` + Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` } func (m *ValidatorUpdate) Reset() { *m = ValidatorUpdate{} } @@ -2963,11 +2964,11 @@ func (m *ValidatorUpdate) XXX_DiscardUnknown() { var xxx_messageInfo_ValidatorUpdate proto.InternalMessageInfo -func (m *ValidatorUpdate) GetPubKey() PubKey { +func (m *ValidatorUpdate) GetPubKey() keys.PublicKey { if m != nil { return m.PubKey } - return PubKey{} + return keys.PublicKey{} } func (m *ValidatorUpdate) GetPower() int64 { @@ -3030,58 +3031,6 @@ func (m *VoteInfo) GetSignedLastBlock() bool { return false } -type PubKey struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (m *PubKey) Reset() { *m = PubKey{} } -func (m *PubKey) String() string { return proto.CompactTextString(m) } -func (*PubKey) ProtoMessage() {} -func (*PubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_9f1eaa49c51fa1ac, []int{44} -} -func (m *PubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PubKey.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKey.Merge(m, src) -} -func (m *PubKey) XXX_Size() int { - return m.Size() -} -func (m *PubKey) XXX_DiscardUnknown() { - xxx_messageInfo_PubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PubKey proto.InternalMessageInfo - -func (m *PubKey) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *PubKey) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - type Evidence struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` Validator Validator `protobuf:"bytes,2,opt,name=validator,proto3" json:"validator"` @@ -3094,7 +3043,7 @@ func (m *Evidence) Reset() { *m = Evidence{} } func (m *Evidence) String() string { return proto.CompactTextString(m) } func (*Evidence) ProtoMessage() {} func (*Evidence) Descriptor() ([]byte, []int) { - return fileDescriptor_9f1eaa49c51fa1ac, []int{45} + return fileDescriptor_9f1eaa49c51fa1ac, []int{44} } func (m *Evidence) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3170,7 +3119,7 @@ func (m *Snapshot) Reset() { *m = Snapshot{} } func (m *Snapshot) String() string { return proto.CompactTextString(m) } func (*Snapshot) ProtoMessage() {} func (*Snapshot) Descriptor() ([]byte, []int) { - return fileDescriptor_9f1eaa49c51fa1ac, []int{46} + return fileDescriptor_9f1eaa49c51fa1ac, []int{45} } func (m *Snapshot) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3282,7 +3231,6 @@ func init() { proto.RegisterType((*Validator)(nil), "tendermint.abci.types.Validator") proto.RegisterType((*ValidatorUpdate)(nil), "tendermint.abci.types.ValidatorUpdate") proto.RegisterType((*VoteInfo)(nil), "tendermint.abci.types.VoteInfo") - proto.RegisterType((*PubKey)(nil), "tendermint.abci.types.PubKey") proto.RegisterType((*Evidence)(nil), "tendermint.abci.types.Evidence") proto.RegisterType((*Snapshot)(nil), "tendermint.abci.types.Snapshot") } @@ -3290,176 +3238,177 @@ func init() { func init() { proto.RegisterFile("abci/types/types.proto", fileDescriptor_9f1eaa49c51fa1ac) } var fileDescriptor_9f1eaa49c51fa1ac = []byte{ - // 2699 bytes of a gzipped FileDescriptorProto + // 2706 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x5a, 0x4b, 0x6f, 0x1b, 0xc9, - 0xf1, 0xe7, 0x90, 0x14, 0x1f, 0x45, 0x91, 0xa2, 0xda, 0x5e, 0x2f, 0x97, 0xff, 0x5d, 0xc9, 0x18, - 0xaf, 0x1f, 0xfb, 0xf8, 0x4b, 0xbb, 0x5a, 0x20, 0xb0, 0x63, 0x27, 0x81, 0x28, 0xcb, 0xa1, 0xe2, - 0x87, 0xe4, 0x91, 0xe4, 0x78, 0x13, 0x60, 0x27, 0xcd, 0x99, 0x16, 0x39, 0x6b, 0x72, 0x66, 0x76, - 0xa6, 0x29, 0x8b, 0x41, 0x0e, 0x41, 0x10, 0x20, 0xc8, 0xcd, 0xb9, 0xe4, 0x96, 0xef, 0x90, 0x43, - 0x80, 0xcd, 0x17, 0x08, 0xb0, 0xc7, 0x3d, 0x05, 0x39, 0x6d, 0x02, 0x3b, 0xa7, 0xe4, 0x4b, 0x04, - 0xfd, 0x98, 0x17, 0xc5, 0xc7, 0x70, 0xe3, 0x5b, 0x2e, 0x44, 0x57, 0x4f, 0x55, 0x75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x48, 0xfe, 0x1f, 0x2e, 0xc4, - 0x78, 0xc3, 0x10, 0x25, 0x90, 0x56, 0x3d, 0xe4, 0xde, 0x96, 0xb1, 0xea, 0x61, 0x64, 0xa0, 0x08, - 0xdc, 0x22, 0xc8, 0x1b, 0x8e, 0x49, 0x64, 0x00, 0xe1, 0x6d, 0x06, 0x78, 0xfb, 0x4e, 0x57, 0x86, - 0x09, 0xd6, 0x64, 0x5c, 0xa1, 0x4f, 0x2d, 0x0b, 0x67, 0xa9, 0xfe, 0x49, 0x89, 0xf4, 0x45, 0x78, - 0x77, 0x12, 0x34, 0x55, 0x5e, 0x27, 0x34, 0xcd, 0xfe, 0x77, 0xd0, 0x54, 0xfd, 0x75, 0x36, 0xda, - 0xd2, 0x10, 0x74, 0x7e, 0x3b, 0x13, 0x44, 0xe1, 0x77, 0x89, 0x6f, 0x90, 0x0c, 0xbf, 0x32, 0x5f, - 0x28, 0xf0, 0x6d, 0x48, 0xe6, 0x0b, 0x45, 0x11, 0x90, 0x39, 0xc1, 0x12, 0x63, 0xd7, 0x73, 0x9c, - 0x13, 0xdd, 0x71, 0xfd, 0x49, 0x19, 0xbf, 0xc0, 0x9b, 0xa2, 0x7a, 0xb4, 0x21, 0xaa, 0x47, 0x1b, - 0x07, 0x4c, 0x60, 0xdf, 0xf5, 0xb5, 0x92, 0x2b, 0x5b, 0x31, 0x98, 0x51, 0x4e, 0x60, 0xe1, 0xb7, - 0xa1, 0xcc, 0x96, 0xe2, 0xbb, 0xd8, 0x20, 0xdc, 0xc9, 0x96, 0xb5, 0xa8, 0x43, 0x35, 0x01, 0x9d, - 0x77, 0xf6, 0xe8, 0x11, 0x14, 0xc8, 0x29, 0xb1, 0x29, 0xdb, 0x33, 0x66, 0xe6, 0xb7, 0xa7, 0x82, - 0x4b, 0x62, 0xd3, 0x56, 0x83, 0x19, 0xf7, 0x5f, 0xdf, 0xac, 0xd7, 0x85, 0xcc, 0x87, 0xce, 0xc0, - 0xa2, 0x64, 0xe0, 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 0x2f, + 0x60, 0xc7, 0x69, 0x63, 0xaf, 0xa7, 0xfc, 0x0c, 0xea, 0xd3, 0xfc, 0xee, 0xd8, 0x62, 0x72, 0xc1, + 0x21, 0xbd, 0x04, 0xf9, 0x63, 0xdb, 0x1d, 0x60, 0xca, 0x95, 0x55, 0x54, 0xd9, 0x63, 0x87, 0x57, + 0xf8, 0xe0, 0x2c, 0x27, 0x8b, 0x8e, 0xa2, 0xc1, 0x3b, 0x53, 0xbd, 0x2e, 0x13, 0x31, 0x2d, 0x83, + 0x08, 0xab, 0x56, 0x54, 0xd1, 0x09, 0x15, 0x89, 0xc9, 0x8a, 0x0e, 0x1b, 0xd6, 0xe3, 0x2b, 0xe6, + 0xfa, 0x4b, 0xaa, 0xec, 0x29, 0x7f, 0x29, 0x41, 0x51, 0x25, 0x9e, 0xc3, 0x1c, 0x02, 0x6a, 0x43, + 0x89, 0x9c, 0xe9, 0x44, 0xe0, 0xaa, 0xf4, 0x1c, 0x14, 0x22, 0x64, 0x76, 0x7c, 0x7e, 0x16, 0xf6, + 0x03, 0x61, 0x74, 0x27, 0x86, 0x29, 0xaf, 0xcc, 0x53, 0x12, 0x05, 0x95, 0xf7, 0xe2, 0xa0, 0xf2, + 0xfd, 0x39, 0xb2, 0x63, 0xa8, 0xf2, 0x4e, 0x0c, 0x55, 0xce, 0x1b, 0x38, 0x06, 0x2b, 0x77, 0x27, + 0xc0, 0xca, 0x79, 0xcb, 0x9f, 0x82, 0x2b, 0x77, 0x27, 0xe0, 0xca, 0x1b, 0x73, 0xe7, 0x32, 0x11, + 0x58, 0xde, 0x8b, 0x03, 0xcb, 0x79, 0xe6, 0x18, 0x43, 0x96, 0x8f, 0x26, 0x21, 0xcb, 0x9b, 0x73, + 0x74, 0x4c, 0x85, 0x96, 0xdb, 0xe7, 0xa0, 0xe5, 0xb5, 0x39, 0xaa, 0x26, 0x60, 0xcb, 0xdd, 0x18, + 0xb6, 0x84, 0x44, 0xb6, 0x99, 0x02, 0x2e, 0x1f, 0x9c, 0x07, 0x97, 0xd7, 0xe7, 0x1d, 0xb5, 0x49, + 0xe8, 0xf2, 0x07, 0x63, 0xe8, 0xf2, 0xea, 0xbc, 0x55, 0x8d, 0xc3, 0xcb, 0xa3, 0x29, 0xf0, 0xf2, + 0xd6, 0x1c, 0x45, 0x73, 0xf0, 0xe5, 0xd1, 0x14, 0x7c, 0x39, 0x4f, 0xed, 0x1c, 0x80, 0xd9, 0x99, + 0x05, 0x30, 0x3f, 0x9a, 0x37, 0xe5, 0x64, 0x08, 0x93, 0xcc, 0x44, 0x98, 0x1f, 0xcf, 0x19, 0x64, + 0x71, 0x88, 0x79, 0x93, 0x05, 0xf9, 0x31, 0x97, 0xc4, 0x5c, 0x21, 0x71, 0x5d, 0xdb, 0x95, 0xe8, + 0x4d, 0x74, 0x94, 0x1b, 0x0c, 0x76, 0x84, 0x8e, 0x67, 0x06, 0x1c, 0xe5, 0x81, 0x27, 0xe2, 0x66, + 0x94, 0x3f, 0xa7, 0x43, 0x59, 0x1e, 0x9d, 0xa3, 0x90, 0xa5, 0x24, 0x21, 0x4b, 0x04, 0xa5, 0x66, + 0xe2, 0x28, 0x75, 0x1d, 0xca, 0x2c, 0x94, 0x8c, 0x01, 0x50, 0xec, 0xf8, 0x00, 0x14, 0x7d, 0x00, + 0xab, 0x1c, 0x43, 0x08, 0x2c, 0x2b, 0xe3, 0x47, 0x8e, 0x07, 0xc3, 0x15, 0xf6, 0x41, 0x1c, 0x5d, + 0x11, 0x48, 0xfe, 0x1f, 0x2e, 0x44, 0x78, 0x83, 0x10, 0x25, 0x90, 0x56, 0x2d, 0xe0, 0xde, 0x92, + 0xb1, 0xea, 0x71, 0x68, 0xa0, 0x10, 0xdc, 0x22, 0xc8, 0xe9, 0xb6, 0x41, 0x64, 0x00, 0xe1, 0x6d, + 0x06, 0x78, 0xfb, 0x76, 0x57, 0x86, 0x09, 0xd6, 0x64, 0x5c, 0x81, 0x4f, 0x2d, 0x09, 0x67, 0xa9, + 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0x83, 0x6f, 0x48, 0x56, 0x2d, 0x74, 0xb1, 0x77, + 0xe4, 0x11, 0x23, 0xb2, 0xd6, 0xc2, 0x9b, 0x58, 0x6b, 0xdc, 0xde, 0xc5, 0x71, 0x7b, 0xff, 0x36, + 0x13, 0xde, 0x96, 0x10, 0x12, 0xff, 0x6f, 0xda, 0xe2, 0x0f, 0x3c, 0x51, 0x8e, 0x47, 0x63, 0xf4, + 0x29, 0xac, 0x06, 0xb7, 0x54, 0x1b, 0xf2, 0xdb, 0xeb, 0x9f, 0xc2, 0xc5, 0x2e, 0x7b, 0xed, 0x34, + 0x4e, 0xf6, 0xd0, 0x67, 0xf0, 0xf6, 0x98, 0x4f, 0x0a, 0x06, 0xc8, 0x2c, 0xe4, 0x9a, 0xde, 0x8a, + 0xbb, 0x26, 0x5f, 0x7f, 0x68, 0xbd, 0xec, 0x1b, 0xb9, 0x35, 0xbb, 0x2c, 0x2d, 0x8b, 0xe2, 0x8c, + 0x89, 0x67, 0xe2, 0x0a, 0x54, 0x5c, 0x42, 0xb1, 0x69, 0x69, 0xb1, 0x54, 0x78, 0x59, 0x10, 0x45, + 0x88, 0x50, 0x9e, 0xc1, 0x5b, 0x13, 0x91, 0x06, 0xfa, 0x1e, 0x94, 0x42, 0xa8, 0x92, 0x9e, 0x99, + 0x49, 0x06, 0x19, 0x51, 0x28, 0xa1, 0x7c, 0x99, 0x0e, 0x15, 0xc7, 0x33, 0xad, 0x87, 0x90, 0x77, + 0x89, 0x37, 0xec, 0x8b, 0xac, 0xa7, 0xba, 0xf9, 0xc9, 0x22, 0x48, 0x85, 0x51, 0x87, 0x7d, 0xaa, + 0x4a, 0x15, 0xca, 0x53, 0xc8, 0x0b, 0x0a, 0x02, 0xc8, 0x6f, 0x6d, 0x6f, 0xef, 0xec, 0x1f, 0xd6, + 0x52, 0xa8, 0x04, 0x4b, 0x5b, 0xad, 0x3d, 0xf5, 0xb0, 0x96, 0x66, 0x64, 0x75, 0xe7, 0x47, 0x3b, + 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, 0x1e, + 0x76, 0xef, 0x4f, 0xac, 0x18, 0x3e, 0x86, 0x65, 0x07, 0xbb, 0xd4, 0xd3, 0x62, 0x75, 0xc3, 0x69, + 0x39, 0xfa, 0x3e, 0x76, 0xe9, 0x01, 0xa1, 0xb1, 0xea, 0x61, 0x99, 0xcb, 0x0b, 0x92, 0x72, 0x07, + 0x2a, 0x31, 0x1e, 0xb6, 0x58, 0x6a, 0x53, 0xdc, 0xf7, 0xcf, 0x0d, 0xef, 0x04, 0x33, 0xc9, 0x84, + 0x33, 0x51, 0xee, 0x42, 0x29, 0x38, 0xd6, 0x2c, 0x03, 0xc1, 0x86, 0xe1, 0x12, 0xcf, 0x93, 0xb3, + 0xf5, 0xbb, 0xbc, 0x44, 0x6a, 0xbf, 0x90, 0x55, 0xa0, 0xac, 0x2a, 0x3a, 0x8a, 0x0d, 0x2b, 0x63, + 0xd1, 0x14, 0x3d, 0x80, 0x82, 0x33, 0xec, 0x68, 0xfe, 0x81, 0x9a, 0x78, 0x9b, 0x24, 0x38, 0x3d, + 0x21, 0x23, 0xaf, 0xb9, 0x3f, 0xec, 0xf4, 0x4d, 0xfd, 0x21, 0x19, 0xf9, 0x06, 0x74, 0x86, 0x9d, + 0x87, 0xe2, 0x08, 0x8a, 0x01, 0x33, 0xd1, 0x01, 0x7f, 0x01, 0x45, 0xff, 0x54, 0xa3, 0xfb, 0xd1, + 0x9b, 0x2b, 0xc6, 0xba, 0x3c, 0x2f, 0xe4, 0xcb, 0x41, 0x42, 0x41, 0x96, 0x39, 0x79, 0x66, 0xd7, + 0x22, 0x86, 0x16, 0x26, 0x45, 0x7c, 0xcc, 0xa2, 0xba, 0x22, 0x3e, 0x3c, 0xf2, 0x33, 0x22, 0xe5, + 0x9f, 0x69, 0x28, 0xfa, 0x8e, 0x64, 0xe2, 0x69, 0x8f, 0x4d, 0x29, 0xf3, 0x6d, 0xa7, 0x34, 0xad, + 0x4c, 0xed, 0x3f, 0x0a, 0xe4, 0x16, 0x7e, 0x14, 0xb8, 0x05, 0x88, 0x9f, 0x00, 0xed, 0xd4, 0xa6, + 0xa6, 0xd5, 0xd5, 0x84, 0x65, 0x05, 0xd4, 0xab, 0xf1, 0x2f, 0xcf, 0xf8, 0x87, 0x7d, 0x6e, 0xe4, + 0x5f, 0xa5, 0xa1, 0x18, 0x04, 0xe6, 0x45, 0xcb, 0x91, 0x97, 0x20, 0x2f, 0x83, 0x8f, 0xa8, 0x47, + 0xca, 0x5e, 0x70, 0xf6, 0x72, 0x91, 0x5b, 0xd0, 0x80, 0xe2, 0x80, 0x50, 0xcc, 0x31, 0x8a, 0x48, + 0x3f, 0x83, 0xfe, 0x07, 0x57, 0xa0, 0x1c, 0xa9, 0x0f, 0xa3, 0x02, 0x64, 0x9f, 0x90, 0x17, 0xb5, + 0x14, 0x2a, 0x43, 0x41, 0x25, 0xbc, 0x24, 0x54, 0x4b, 0x6f, 0x7e, 0x59, 0x86, 0x95, 0xad, 0xd6, + 0xf6, 0x2e, 0x8b, 0x8d, 0xa6, 0x8e, 0x79, 0x6a, 0xba, 0x07, 0x39, 0x9e, 0x9d, 0x27, 0x78, 0x8f, + 0x6e, 0x24, 0xa9, 0x2f, 0x22, 0x15, 0x96, 0x78, 0x12, 0x8f, 0x92, 0x3c, 0x53, 0x37, 0x12, 0x95, + 0x1d, 0xd9, 0x24, 0xf9, 0x19, 0x4e, 0xf0, 0x7a, 0xdd, 0x48, 0x52, 0x8b, 0x44, 0x9f, 0x41, 0x29, + 0xcc, 0xce, 0x93, 0xbe, 0x69, 0x37, 0x12, 0x57, 0x29, 0x99, 0xfe, 0x30, 0xff, 0x48, 0xfa, 0xa2, + 0xdb, 0x48, 0xec, 0x3d, 0xd1, 0x73, 0x28, 0xf8, 0x99, 0x5e, 0xb2, 0x57, 0xe7, 0x46, 0xc2, 0x0a, + 0x22, 0xdb, 0x3e, 0x91, 0xb0, 0x27, 0x79, 0x5a, 0x6f, 0x24, 0x2a, 0x93, 0xa2, 0x23, 0xc8, 0x4b, + 0x88, 0x9d, 0xe8, 0x3d, 0xb9, 0x91, 0xac, 0x2e, 0xc8, 0x8c, 0x1c, 0x96, 0x44, 0x92, 0xfe, 0x9d, + 0xa0, 0x91, 0xb8, 0x3e, 0x8c, 0x30, 0x40, 0x24, 0x6b, 0x4f, 0xfc, 0x3f, 0x81, 0x46, 0xf2, 0xba, + 0x2f, 0xfa, 0x29, 0x14, 0x83, 0xdc, 0x2c, 0xe1, 0x7b, 0x7d, 0x23, 0x69, 0xe9, 0x15, 0x7d, 0x0e, + 0x95, 0x78, 0x3a, 0xb2, 0xc8, 0x2b, 0x7c, 0x63, 0xa1, 0x9a, 0x2a, 0x1b, 0x2b, 0x9e, 0xa1, 0x2c, + 0xf2, 0x36, 0xdf, 0x58, 0xa8, 0xd0, 0x8a, 0x4e, 0x61, 0xf5, 0x7c, 0x52, 0xb1, 0xe8, 0x83, 0x7d, + 0x63, 0xe1, 0x02, 0x2c, 0x1a, 0x01, 0x9a, 0x90, 0x98, 0x2c, 0xfc, 0x8a, 0xdf, 0x58, 0xbc, 0x2a, + 0xdb, 0xda, 0xf9, 0xea, 0xd5, 0x5a, 0xfa, 0xeb, 0x57, 0x6b, 0xe9, 0x7f, 0xbc, 0x5a, 0x4b, 0xbf, + 0x7c, 0xbd, 0x96, 0xfa, 0xfa, 0xf5, 0x5a, 0xea, 0x6f, 0xaf, 0xd7, 0x52, 0x3f, 0xf9, 0xb0, 0x6b, + 0xd2, 0xde, 0xb0, 0xd3, 0xd4, 0xed, 0xc1, 0x46, 0xa8, 0x36, 0xda, 0x0c, 0xff, 0x6d, 0xd5, 0xc9, + 0xf3, 0xe0, 0xf7, 0xc9, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x75, 0x7a, 0xc6, 0x83, 0x82, 0x25, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -6569,43 +6518,6 @@ func (m *VoteInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PubKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x12 - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *Evidence) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -7903,23 +7815,6 @@ func (m *VoteInfo) Size() (n int) { return n } -func (m *PubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - return n -} - func (m *Evidence) Size() (n int) { if m == nil { return 0 @@ -14477,125 +14372,6 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *PubKey) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Evidence) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/abci/types/types.proto b/abci/types/types.proto index 2a9d0927d..7148cf1f2 100644 --- a/abci/types/types.proto +++ b/abci/types/types.proto @@ -6,6 +6,7 @@ option go_package = "github.com/tendermint/tendermint/abci/types"; // https://github.com/gogo/protobuf/blob/master/extensions.md import "proto/crypto/merkle/types.proto"; import "proto/types/types.proto"; +import "proto/crypto/keys/types.proto"; import "proto/types/params.proto"; import "google/protobuf/timestamp.proto"; import "third_party/proto/gogoproto/gogo.proto"; @@ -341,8 +342,8 @@ message Validator { // ValidatorUpdate message ValidatorUpdate { - PubKey pub_key = 1 [(gogoproto.nullable) = false]; - int64 power = 2; + tendermint.proto.crypto.keys.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; + int64 power = 2; } // VoteInfo @@ -351,11 +352,6 @@ message VoteInfo { bool signed_last_block = 2; } -message PubKey { - string type = 1; - bytes data = 2; -} - message Evidence { string type = 1; Validator validator = 2 [(gogoproto.nullable) = false]; diff --git a/abci/types/util.go b/abci/types/util.go index 3cde88232..94a34c0c1 100644 --- a/abci/types/util.go +++ b/abci/types/util.go @@ -1,7 +1,6 @@ package types import ( - "bytes" "sort" ) @@ -24,7 +23,7 @@ func (v ValidatorUpdates) Len() int { // XXX: doesn't distinguish same validator with different power func (v ValidatorUpdates) Less(i, j int) bool { - return bytes.Compare(v[i].PubKey.Data, v[j].PubKey.Data) <= 0 + return v[i].PubKey.Compare(v[j].PubKey) <= 0 } func (v ValidatorUpdates) Swap(i, j int) { diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index f85f3b84c..57aec1f3b 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -21,6 +21,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" cfg "github.com/tendermint/tendermint/config" cstypes "github.com/tendermint/tendermint/consensus/types" + cryptoenc "github.com/tendermint/tendermint/crypto/encoding" "github.com/tendermint/tendermint/crypto/tmhash" "github.com/tendermint/tendermint/libs/bits" "github.com/tendermint/tendermint/libs/bytes" @@ -361,7 +362,9 @@ func TestReactorVotingPowerChange(t *testing.T) { val1PubKey, err := css[0].privValidator.GetPubKey() require.NoError(t, err) - val1PubKeyABCI := types.TM2PB.PubKey(val1PubKey) + + val1PubKeyABCI, err := cryptoenc.PubKeyToProto(val1PubKey) + require.NoError(t, err) updateValidatorTx := kvstore.MakeValSetChangeTx(val1PubKeyABCI, 25) previousTotalVotingPower := css[0].GetRoundState().LastValidators.TotalVotingPower() @@ -441,8 +444,9 @@ func TestReactorValidatorSetChanges(t *testing.T) { logger.Info("---------------------------- Testing adding one validator") newValidatorPubKey1, err := css[nVals].privValidator.GetPubKey() - require.NoError(t, err) - valPubKey1ABCI := types.TM2PB.PubKey(newValidatorPubKey1) + assert.NoError(t, err) + valPubKey1ABCI, err := cryptoenc.PubKeyToProto(newValidatorPubKey1) + assert.NoError(t, err) newValidatorTx1 := kvstore.MakeValSetChangeTx(valPubKey1ABCI, testMinPower) // wait till everyone makes block 2 @@ -470,7 +474,8 @@ func TestReactorValidatorSetChanges(t *testing.T) { updateValidatorPubKey1, err := css[nVals].privValidator.GetPubKey() require.NoError(t, err) - updatePubKey1ABCI := types.TM2PB.PubKey(updateValidatorPubKey1) + updatePubKey1ABCI, err := cryptoenc.PubKeyToProto(updateValidatorPubKey1) + require.NoError(t, err) updateValidatorTx1 := kvstore.MakeValSetChangeTx(updatePubKey1ABCI, 25) previousTotalVotingPower := css[nVals].GetRoundState().LastValidators.TotalVotingPower() @@ -491,12 +496,14 @@ func TestReactorValidatorSetChanges(t *testing.T) { newValidatorPubKey2, err := css[nVals+1].privValidator.GetPubKey() require.NoError(t, err) - newVal2ABCI := types.TM2PB.PubKey(newValidatorPubKey2) + newVal2ABCI, err := cryptoenc.PubKeyToProto(newValidatorPubKey2) + require.NoError(t, err) newValidatorTx2 := kvstore.MakeValSetChangeTx(newVal2ABCI, testMinPower) newValidatorPubKey3, err := css[nVals+2].privValidator.GetPubKey() require.NoError(t, err) - newVal3ABCI := types.TM2PB.PubKey(newValidatorPubKey3) + newVal3ABCI, err := cryptoenc.PubKeyToProto(newValidatorPubKey3) + require.NoError(t, err) newValidatorTx3 := kvstore.MakeValSetChangeTx(newVal3ABCI, testMinPower) waitForAndValidateBlock(t, nPeers, activeVals, blocksSubs, css, newValidatorTx2, newValidatorTx3) diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 3d77efd08..7b4df25b0 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -22,6 +22,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" cfg "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/crypto" + cryptoenc "github.com/tendermint/tendermint/crypto/encoding" "github.com/tendermint/tendermint/libs/log" tmrand "github.com/tendermint/tendermint/libs/rand" mempl "github.com/tendermint/tendermint/mempool" @@ -351,7 +352,8 @@ func TestSimulateValidatorsChange(t *testing.T) { incrementHeight(vss...) newValidatorPubKey1, err := css[nVals].privValidator.GetPubKey() require.NoError(t, err) - valPubKey1ABCI := types.TM2PB.PubKey(newValidatorPubKey1) + valPubKey1ABCI, err := cryptoenc.PubKeyToProto(newValidatorPubKey1) + require.NoError(t, err) newValidatorTx1 := kvstore.MakeValSetChangeTx(valPubKey1ABCI, testMinPower) err = assertMempool(css[0].txNotifier).CheckTx(newValidatorTx1, nil, mempl.TxInfo{}) assert.Nil(t, err) @@ -379,7 +381,8 @@ func TestSimulateValidatorsChange(t *testing.T) { incrementHeight(vss...) updateValidatorPubKey1, err := css[nVals].privValidator.GetPubKey() require.NoError(t, err) - updatePubKey1ABCI := types.TM2PB.PubKey(updateValidatorPubKey1) + updatePubKey1ABCI, err := cryptoenc.PubKeyToProto(updateValidatorPubKey1) + require.NoError(t, err) updateValidatorTx1 := kvstore.MakeValSetChangeTx(updatePubKey1ABCI, 25) err = assertMempool(css[0].txNotifier).CheckTx(updateValidatorTx1, nil, mempl.TxInfo{}) assert.Nil(t, err) @@ -407,13 +410,15 @@ func TestSimulateValidatorsChange(t *testing.T) { incrementHeight(vss...) newValidatorPubKey2, err := css[nVals+1].privValidator.GetPubKey() require.NoError(t, err) - newVal2ABCI := types.TM2PB.PubKey(newValidatorPubKey2) + newVal2ABCI, err := cryptoenc.PubKeyToProto(newValidatorPubKey2) + require.NoError(t, err) newValidatorTx2 := kvstore.MakeValSetChangeTx(newVal2ABCI, testMinPower) err = assertMempool(css[0].txNotifier).CheckTx(newValidatorTx2, nil, mempl.TxInfo{}) assert.Nil(t, err) newValidatorPubKey3, err := css[nVals+2].privValidator.GetPubKey() require.NoError(t, err) - newVal3ABCI := types.TM2PB.PubKey(newValidatorPubKey3) + newVal3ABCI, err := cryptoenc.PubKeyToProto(newValidatorPubKey3) + require.NoError(t, err) newValidatorTx3 := kvstore.MakeValSetChangeTx(newVal3ABCI, testMinPower) err = assertMempool(css[0].txNotifier).CheckTx(newValidatorTx3, nil, mempl.TxInfo{}) assert.Nil(t, err) diff --git a/crypto/crypto.go b/crypto/crypto.go index 045a35e86..765632f71 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -24,6 +24,7 @@ type PubKey interface { Bytes() []byte VerifyBytes(msg []byte, sig []byte) bool Equals(PubKey) bool + Type() string } type PrivKey interface { @@ -31,6 +32,7 @@ type PrivKey interface { Sign(msg []byte) ([]byte, error) PubKey() PubKey Equals(PrivKey) bool + Type() string } type Symmetric interface { diff --git a/crypto/ed25519/ed25519.go b/crypto/ed25519/ed25519.go index 19c383525..504da8783 100644 --- a/crypto/ed25519/ed25519.go +++ b/crypto/ed25519/ed25519.go @@ -30,6 +30,8 @@ const ( // SeedSize is the size, in bytes, of private key seeds. These are the // private key representations used by RFC 8032. SeedSize = 32 + + keyType = "ed25519" ) func init() { @@ -90,6 +92,10 @@ func (privKey PrivKey) Equals(other crypto.PrivKey) bool { return false } +func (privKey PrivKey) Type() string { + return keyType +} + // GenPrivKey generates a new ed25519 private key. // It uses OS randomness in conjunction with the current global random seed // in tendermint/libs/common to generate the private key. @@ -151,6 +157,10 @@ func (pubKey PubKey) String() string { return fmt.Sprintf("PubKeyEd25519{%X}", []byte(pubKey)) } +func (pubKey PubKey) Type() string { + return keyType +} + func (pubKey PubKey) Equals(other crypto.PubKey) bool { if otherEd, ok := other.(PubKey); ok { return bytes.Equal(pubKey[:], otherEd[:]) diff --git a/crypto/encoding/amino/encode_test.go b/crypto/encoding/amino/encode_test.go index 8e5e44c3a..509ffa279 100644 --- a/crypto/encoding/amino/encode_test.go +++ b/crypto/encoding/amino/encode_test.go @@ -160,6 +160,7 @@ func (privkey testPriv) Bytes() []byte { } func (privkey testPriv) Sign(msg []byte) ([]byte, error) { return []byte{}, nil } func (privkey testPriv) Equals(other crypto.PrivKey) bool { return true } +func (privkey testPriv) Type() string { return "testPriv" } type testPub []byte @@ -169,6 +170,8 @@ func (key testPub) Bytes() []byte { } func (key testPub) VerifyBytes(msg []byte, sig []byte) bool { return true } func (key testPub) Equals(other crypto.PubKey) bool { return true } +func (key testPub) String() string { return "" } +func (key testPub) Type() string { return "testPub" } var ( privAminoName = "registerTest/Priv" diff --git a/crypto/secp256k1/secp256k1.go b/crypto/secp256k1/secp256k1.go index 2fbf1799b..c223510dd 100644 --- a/crypto/secp256k1/secp256k1.go +++ b/crypto/secp256k1/secp256k1.go @@ -16,7 +16,10 @@ import ( var _ crypto.PrivKey = PrivKey{} -const PrivKeySize = 32 +const ( + PrivKeySize = 32 + keyType = "secp256k1" +) // PrivKey implements PrivKey. type PrivKey []byte @@ -42,6 +45,10 @@ func (privKey PrivKey) Equals(other crypto.PrivKey) bool { return false } +func (privKey PrivKey) Type() string { + return keyType +} + // GenPrivKey generates a new ECDSA private key on curve secp256k1 private key. // It uses OS randomness to generate the private key. func GenPrivKey() PrivKey { @@ -140,6 +147,10 @@ func (pubKey PubKey) String() string { return fmt.Sprintf("PubKeySecp256k1{%X}", []byte(pubKey)) } +func (pubKey PubKey) Type() string { + return keyType +} + func (pubKey PubKey) Equals(other crypto.PubKey) bool { if otherSecp, ok := other.(PubKey); ok { return bytes.Equal(pubKey[:], otherSecp[:]) diff --git a/crypto/sr25519/privkey.go b/crypto/sr25519/privkey.go index 47d970796..215a50173 100644 --- a/crypto/sr25519/privkey.go +++ b/crypto/sr25519/privkey.go @@ -69,6 +69,10 @@ func (privKey PrivKey) Equals(other crypto.PrivKey) bool { return false } +func (privKey PrivKey) Type() string { + return keyType +} + // GenPrivKey generates a new sr25519 private key. // It uses OS randomness in conjunction with the current global random seed // in tendermint/libs/common to generate the private key. diff --git a/crypto/sr25519/pubkey.go b/crypto/sr25519/pubkey.go index 0b578057a..1256136d3 100644 --- a/crypto/sr25519/pubkey.go +++ b/crypto/sr25519/pubkey.go @@ -13,7 +13,10 @@ import ( var _ crypto.PubKey = PubKey{} // PubKeySize is the number of bytes in an Sr25519 public key. -const PubKeySize = 32 +const ( + PubKeySize = 32 + keyType = "sr25519" +) // PubKeySr25519 implements crypto.PubKey for the Sr25519 signature scheme. type PubKey []byte @@ -67,3 +70,8 @@ func (pubKey PubKey) Equals(other crypto.PubKey) bool { } return false } + +func (pubKey PubKey) Type() string { + return keyType + +} diff --git a/p2p/conn/secret_connection_test.go b/p2p/conn/secret_connection_test.go index 9ded86a15..914ebc40a 100644 --- a/p2p/conn/secret_connection_test.go +++ b/p2p/conn/secret_connection_test.go @@ -51,6 +51,7 @@ func (pk privKeyWithNilPubKey) Bytes() []byte { return pk.orig func (pk privKeyWithNilPubKey) Sign(msg []byte) ([]byte, error) { return pk.orig.Sign(msg) } func (pk privKeyWithNilPubKey) PubKey() crypto.PubKey { return nil } func (pk privKeyWithNilPubKey) Equals(pk2 crypto.PrivKey) bool { return pk.orig.Equals(pk2) } +func (pk privKeyWithNilPubKey) Type() string { return "privKeyWithNilPubKey" } func TestSecretConnectionHandshake(t *testing.T) { fooSecConn, barSecConn := makeSecretConnPair(t) diff --git a/proto/crypto/keys/types.pb.go b/proto/crypto/keys/types.pb.go index 271cb4932..fd379dfbe 100644 --- a/proto/crypto/keys/types.pb.go +++ b/proto/crypto/keys/types.pb.go @@ -8,7 +8,6 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - golang_proto "github.com/golang/protobuf/proto" io "io" math "math" math_bits "math/bits" @@ -16,7 +15,6 @@ import ( // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal -var _ = golang_proto.Marshal var _ = fmt.Errorf var _ = math.Inf @@ -177,18 +175,13 @@ func (*PrivateKey) XXX_OneofWrappers() []interface{} { func init() { proto.RegisterType((*PublicKey)(nil), "tendermint.proto.crypto.keys.PublicKey") - golang_proto.RegisterType((*PublicKey)(nil), "tendermint.proto.crypto.keys.PublicKey") proto.RegisterType((*PrivateKey)(nil), "tendermint.proto.crypto.keys.PrivateKey") - golang_proto.RegisterType((*PrivateKey)(nil), "tendermint.proto.crypto.keys.PrivateKey") } func init() { proto.RegisterFile("proto/crypto/keys/types.proto", fileDescriptor_943d79b57ec0188f) } -func init() { - golang_proto.RegisterFile("proto/crypto/keys/types.proto", fileDescriptor_943d79b57ec0188f) -} var fileDescriptor_943d79b57ec0188f = []byte{ - // 220 bytes of a gzipped FileDescriptorProto + // 215 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0xcf, 0x4e, 0xad, 0x2c, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x03, 0x8b, 0x0b, 0xc9, 0x94, 0xa4, 0xe6, 0xa5, 0xa4, 0x16, 0xe5, 0x66, @@ -198,11 +191,11 @@ var fileDescriptor_943d79b57ec0188f = []byte{ 0x52, 0x5c, 0xec, 0xa9, 0x29, 0x46, 0xa6, 0xa6, 0x86, 0x96, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x1e, 0x0c, 0x41, 0x30, 0x01, 0x2b, 0x8e, 0x17, 0x0b, 0xe4, 0x19, 0x5f, 0x2c, 0x94, 0x67, 0x74, 0x62, 0xe5, 0x62, 0x2e, 0x2e, 0xcd, 0x55, 0xd2, 0xe7, 0xe2, 0x0a, 0x28, 0xca, 0x2c, 0x4b, 0x2c, - 0x49, 0x25, 0xa0, 0x15, 0xaa, 0xc1, 0x29, 0xe0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, - 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc0, 0x63, 0x39, 0xc6, 0x0b, 0x8f, 0xe5, - 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4a, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, - 0xcf, 0xd5, 0x47, 0xf8, 0x0c, 0x99, 0x89, 0x11, 0x1c, 0x49, 0x6c, 0x60, 0x21, 0x63, 0x40, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xc1, 0xcf, 0x98, 0xcb, 0x2a, 0x01, 0x00, 0x00, + 0x49, 0x25, 0xa0, 0x15, 0xaa, 0xc1, 0xc9, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, + 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, + 0x18, 0xa2, 0x8c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x11, 0xbe, + 0x42, 0x66, 0x62, 0x04, 0x45, 0x12, 0x1b, 0x58, 0xc8, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x85, + 0x0d, 0xee, 0x82, 0x26, 0x01, 0x00, 0x00, } func (this *PublicKey) Compare(that interface{}) int { diff --git a/proto/crypto/keys/types.proto b/proto/crypto/keys/types.proto index 8ad0d6674..be4abd609 100644 --- a/proto/crypto/keys/types.proto +++ b/proto/crypto/keys/types.proto @@ -5,11 +5,6 @@ option go_package = "github.com/tendermint/tendermint/proto/crypto/keys"; import "third_party/proto/gogoproto/gogo.proto"; -option (gogoproto.marshaler_all) = true; -option (gogoproto.unmarshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.goproto_registration) = true; - // PublicKey defines the keys available for use with Tendermint Validators message PublicKey { option (gogoproto.compare) = true; diff --git a/proto/crypto/merkle/types.pb.go b/proto/crypto/merkle/types.pb.go index 06835cc3b..41e452962 100644 --- a/proto/crypto/merkle/types.pb.go +++ b/proto/crypto/merkle/types.pb.go @@ -154,7 +154,7 @@ func (m *ProofOp) GetData() []byte { return nil } -// Proof is Merkle proof defined by the list of ProofOps +// ProofOps is Merkle proof defined by the list of ProofOps type ProofOps struct { Ops []ProofOp `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops"` } diff --git a/rpc/client/evidence_test.go b/rpc/client/evidence_test.go index e7ad34d07..71f6a4b9b 100644 --- a/rpc/client/evidence_test.go +++ b/rpc/client/evidence_test.go @@ -11,6 +11,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" + cryptoenc "github.com/tendermint/tendermint/crypto/encoding" "github.com/tendermint/tendermint/crypto/tmhash" "github.com/tendermint/tendermint/privval" tmproto "github.com/tendermint/tendermint/proto/types" @@ -122,7 +123,8 @@ func TestBroadcastEvidence_DuplicateVoteEvidence(t *testing.T) { status, err := c.Status() require.NoError(t, err) - client.WaitForHeight(c, status.SyncInfo.LatestBlockHeight+2, nil) + err = client.WaitForHeight(c, status.SyncInfo.LatestBlockHeight+2, nil) + require.NoError(t, err) ed25519pub := pv.Key.PubKey.(ed25519.PubKey) rawpub := ed25519pub.Bytes() @@ -135,7 +137,10 @@ func TestBroadcastEvidence_DuplicateVoteEvidence(t *testing.T) { err = abci.ReadMessage(bytes.NewReader(qres.Value), &v) require.NoError(t, err, "Error reading query result, value %v", qres.Value) - require.EqualValues(t, rawpub, v.PubKey.Data, "Stored PubKey not equal with expected, value %v", string(qres.Value)) + pk, err := cryptoenc.PubKeyFromProto(v.PubKey) + require.NoError(t, err) + + require.EqualValues(t, rawpub, pk.Bytes(), "Stored PubKey not equal with expected, value %v", string(qres.Value)) require.Equal(t, int64(9), v.Power, "Stored Power not equal with expected, value %v", string(qres.Value)) for _, fake := range fakes { diff --git a/rpc/client/helpers.go b/rpc/client/helpers.go index b090ac104..af8d4998e 100644 --- a/rpc/client/helpers.go +++ b/rpc/client/helpers.go @@ -48,6 +48,7 @@ func WaitForHeight(c StatusClient, h int64, waiter Waiter) error { return err } } + return nil } diff --git a/rpc/client/http/http.go b/rpc/client/http/http.go index 88625aeb2..ed6b6dbe3 100644 --- a/rpc/client/http/http.go +++ b/rpc/client/http/http.go @@ -207,6 +207,7 @@ func (c *baseRPCClient) Status() (*ctypes.ResultStatus, error) { if err != nil { return nil, err } + return result, nil } @@ -216,6 +217,7 @@ func (c *baseRPCClient) ABCIInfo() (*ctypes.ResultABCIInfo, error) { if err != nil { return nil, err } + return result, nil } @@ -234,6 +236,7 @@ func (c *baseRPCClient) ABCIQueryWithOptions( if err != nil { return nil, err } + return result, nil } diff --git a/rpc/client/rpc_test.go b/rpc/client/rpc_test.go index 3420df667..312e4c05a 100644 --- a/rpc/client/rpc_test.go +++ b/rpc/client/rpc_test.go @@ -13,7 +13,6 @@ import ( "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" tmmath "github.com/tendermint/tendermint/libs/math" mempl "github.com/tendermint/tendermint/mempool" diff --git a/state/execution.go b/state/execution.go index 350194cdd..739855675 100644 --- a/state/execution.go +++ b/state/execution.go @@ -8,6 +8,7 @@ import ( dbm "github.com/tendermint/tm-db" abci "github.com/tendermint/tendermint/abci/types" + cryptoenc "github.com/tendermint/tendermint/crypto/encoding" "github.com/tendermint/tendermint/libs/fail" "github.com/tendermint/tendermint/libs/log" mempl "github.com/tendermint/tendermint/mempool" @@ -380,10 +381,14 @@ func validateValidatorUpdates(abciUpdates []abci.ValidatorUpdate, } // Check if validator's pubkey matches an ABCI type in the consensus params - thisKeyType := valUpdate.PubKey.Type - if !types.IsValidPubkeyType(params, thisKeyType) { + pk, err := cryptoenc.PubKeyFromProto(valUpdate.PubKey) + if err != nil { + return err + } + + if !types.IsValidPubkeyType(params, pk.Type()) { return fmt.Errorf("validator %v is using pubkey %s, which is unsupported for consensus", - valUpdate, thisKeyType) + valUpdate, pk.Type()) } } return nil diff --git a/state/execution_test.go b/state/execution_test.go index f20454c5f..c37f0d5e8 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -11,7 +11,7 @@ import ( "github.com/tendermint/tendermint/abci/example/kvstore" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/secp256k1" + cryptoenc "github.com/tendermint/tendermint/crypto/encoding" "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/mempool/mock" tmproto "github.com/tendermint/tendermint/proto/types" @@ -175,8 +175,10 @@ func TestBeginBlockByzantineValidators(t *testing.T) { func TestValidateValidatorUpdates(t *testing.T) { pubkey1 := ed25519.GenPrivKey().PubKey() pubkey2 := ed25519.GenPrivKey().PubKey() - - secpKey := secp256k1.GenPrivKey().PubKey() + pk1, err := cryptoenc.PubKeyToProto(pubkey1) + assert.NoError(t, err) + pk2, err := cryptoenc.PubKeyToProto(pubkey2) + assert.NoError(t, err) defaultValidatorParams := tmproto.ValidatorParams{PubKeyTypes: []string{types.ABCIPubKeyTypeEd25519}} @@ -190,42 +192,26 @@ func TestValidateValidatorUpdates(t *testing.T) { }{ { "adding a validator is OK", - - []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey2), Power: 20}}, + []abci.ValidatorUpdate{{PubKey: pk2, Power: 20}}, defaultValidatorParams, - false, }, { "updating a validator is OK", - - []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey1), Power: 20}}, + []abci.ValidatorUpdate{{PubKey: pk1, Power: 20}}, defaultValidatorParams, - false, }, { "removing a validator is OK", - - []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey2), Power: 0}}, + []abci.ValidatorUpdate{{PubKey: pk2, Power: 0}}, defaultValidatorParams, - false, }, { "adding a validator with negative power results in error", - - []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey2), Power: -100}}, + []abci.ValidatorUpdate{{PubKey: pk2, Power: -100}}, defaultValidatorParams, - - true, - }, - { - "adding a validator with pubkey thats not in validator params results in error", - - []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(secpKey), Power: -100}}, - defaultValidatorParams, - true, }, } @@ -249,6 +235,11 @@ func TestUpdateValidators(t *testing.T) { pubkey2 := ed25519.GenPrivKey().PubKey() val2 := types.NewValidator(pubkey2, 20) + pk, err := cryptoenc.PubKeyToProto(pubkey1) + require.NoError(t, err) + pk2, err := cryptoenc.PubKeyToProto(pubkey2) + require.NoError(t, err) + testCases := []struct { name string @@ -260,37 +251,29 @@ func TestUpdateValidators(t *testing.T) { }{ { "adding a validator is OK", - types.NewValidatorSet([]*types.Validator{val1}), - []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey2), Power: 20}}, - + []abci.ValidatorUpdate{{PubKey: pk2, Power: 20}}, types.NewValidatorSet([]*types.Validator{val1, val2}), false, }, { "updating a validator is OK", - types.NewValidatorSet([]*types.Validator{val1}), - []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey1), Power: 20}}, - + []abci.ValidatorUpdate{{PubKey: pk, Power: 20}}, types.NewValidatorSet([]*types.Validator{types.NewValidator(pubkey1, 20)}), false, }, { "removing a validator is OK", - types.NewValidatorSet([]*types.Validator{val1, val2}), - []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey2), Power: 0}}, - + []abci.ValidatorUpdate{{PubKey: pk2, Power: 0}}, types.NewValidatorSet([]*types.Validator{val1}), false, }, { "removing a non-existing validator results in error", - types.NewValidatorSet([]*types.Validator{val1}), - []abci.ValidatorUpdate{{PubKey: types.TM2PB.PubKey(pubkey2), Power: 0}}, - + []abci.ValidatorUpdate{{PubKey: pk2, Power: 0}}, types.NewValidatorSet([]*types.Validator{val1}), true, }, @@ -355,13 +338,14 @@ func TestEndBlockValidatorUpdates(t *testing.T) { blockID := types.BlockID{Hash: block.Hash(), PartsHeader: block.MakePartSet(testPartSize).Header()} pubkey := ed25519.GenPrivKey().PubKey() + pk, err := cryptoenc.PubKeyToProto(pubkey) + require.NoError(t, err) app.ValidatorUpdates = []abci.ValidatorUpdate{ - {PubKey: types.TM2PB.PubKey(pubkey), Power: 10}, + {PubKey: pk, Power: 10}, } state, _, err = blockExec.ApplyBlock(state, blockID, block) require.Nil(t, err) - // test new validator was added to NextValidators if assert.Equal(t, state.Validators.Size()+1, state.NextValidators.Size()) { idx, _ := state.NextValidators.GetByAddress(pubkey.Address()) @@ -408,9 +392,11 @@ func TestEndBlockValidatorUpdatesResultingInEmptySet(t *testing.T) { block := makeBlock(state, 1) blockID := types.BlockID{Hash: block.Hash(), PartsHeader: block.MakePartSet(testPartSize).Header()} + vp, err := cryptoenc.PubKeyToProto(state.Validators.Validators[0].PubKey) + require.NoError(t, err) // Remove the only validator app.ValidatorUpdates = []abci.ValidatorUpdate{ - {PubKey: types.TM2PB.PubKey(state.Validators.Validators[0].PubKey), Power: 0}, + {PubKey: vp, Power: 0}, } assert.NotPanics(t, func() { state, _, err = blockExec.ApplyBlock(state, blockID, block) }) diff --git a/state/state_test.go b/state/state_test.go index 83ba3bf95..4cae6f97b 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -17,6 +17,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" cfg "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/crypto/ed25519" + cryptoenc "github.com/tendermint/tendermint/crypto/encoding" tmrand "github.com/tendermint/tendermint/libs/rand" tmstate "github.com/tendermint/tendermint/proto/state" tmproto "github.com/tendermint/tendermint/proto/types" @@ -432,7 +433,10 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { // add a validator val2PubKey := ed25519.GenPrivKey().PubKey() val2VotingPower := int64(100) - updateAddVal := abci.ValidatorUpdate{PubKey: types.TM2PB.PubKey(val2PubKey), Power: val2VotingPower} + fvp, err := cryptoenc.PubKeyToProto(val2PubKey) + require.NoError(t, err) + + updateAddVal := abci.ValidatorUpdate{PubKey: fvp, Power: val2VotingPower} validatorUpdates, err = types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{updateAddVal}) assert.NoError(t, err) updatedState2, err := sm.UpdateState(updatedState, blockID, &block.Header, abciResponses, validatorUpdates) @@ -468,7 +472,7 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { // Updating a validator does not reset the ProposerPriority to zero: // 1. Add - Val2 VotingPower change to 1 => updatedVotingPowVal2 := int64(1) - updateVal := abci.ValidatorUpdate{PubKey: types.TM2PB.PubKey(val2PubKey), Power: updatedVotingPowVal2} + updateVal := abci.ValidatorUpdate{PubKey: fvp, Power: updatedVotingPowVal2} validatorUpdates, err = types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{updateVal}) assert.NoError(t, err) @@ -546,7 +550,9 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { // add a validator with the same voting power as the first val2PubKey := ed25519.GenPrivKey().PubKey() - updateAddVal := abci.ValidatorUpdate{PubKey: types.TM2PB.PubKey(val2PubKey), Power: val1VotingPower} + fvp, err := cryptoenc.PubKeyToProto(val2PubKey) + require.NoError(t, err) + updateAddVal := abci.ValidatorUpdate{PubKey: fvp, Power: val1VotingPower} validatorUpdates, err = types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{updateAddVal}) assert.NoError(t, err) @@ -727,7 +733,9 @@ func TestLargeGenesisValidator(t *testing.T) { // see: https://github.com/tendermint/tendermint/issues/2960 firstAddedValPubKey := ed25519.GenPrivKey().PubKey() firstAddedValVotingPower := int64(10) - firstAddedVal := abci.ValidatorUpdate{PubKey: types.TM2PB.PubKey(firstAddedValPubKey), Power: firstAddedValVotingPower} + fvp, err := cryptoenc.PubKeyToProto(firstAddedValPubKey) + require.NoError(t, err) + firstAddedVal := abci.ValidatorUpdate{PubKey: fvp, Power: firstAddedValVotingPower} validatorUpdates, err := types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{firstAddedVal}) assert.NoError(t, err) abciResponses := &tmstate.ABCIResponses{ @@ -770,8 +778,9 @@ func TestLargeGenesisValidator(t *testing.T) { // add 10 validators with the same voting power as the one added directly after genesis: for i := 0; i < 10; i++ { addedPubKey := ed25519.GenPrivKey().PubKey() - - addedVal := abci.ValidatorUpdate{PubKey: types.TM2PB.PubKey(addedPubKey), Power: firstAddedValVotingPower} + ap, err := cryptoenc.PubKeyToProto(addedPubKey) + require.NoError(t, err) + addedVal := abci.ValidatorUpdate{PubKey: ap, Power: firstAddedValVotingPower} validatorUpdates, err := types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{addedVal}) assert.NoError(t, err) @@ -786,7 +795,9 @@ func TestLargeGenesisValidator(t *testing.T) { require.Equal(t, 10+2, len(state.NextValidators.Validators)) // remove genesis validator: - removeGenesisVal := abci.ValidatorUpdate{PubKey: types.TM2PB.PubKey(genesisPubKey), Power: 0} + gp, err := cryptoenc.PubKeyToProto(genesisPubKey) + require.NoError(t, err) + removeGenesisVal := abci.ValidatorUpdate{PubKey: gp, Power: 0} abciResponses = &tmstate.ABCIResponses{ EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: []abci.ValidatorUpdate{removeGenesisVal}}, } diff --git a/types/protobuf.go b/types/protobuf.go index f745f2247..f3a40ff3e 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -8,6 +8,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" + cryptoenc "github.com/tendermint/tendermint/crypto/encoding" "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/tendermint/tendermint/crypto/sr25519" tmproto "github.com/tendermint/tendermint/proto/types" @@ -89,36 +90,16 @@ func (tm2pb) PartSetHeader(header PartSetHeader) abci.PartSetHeader { // XXX: panics on unknown pubkey type func (tm2pb) ValidatorUpdate(val *Validator) abci.ValidatorUpdate { + pk, err := cryptoenc.PubKeyToProto(val.PubKey) + if err != nil { + panic(err) + } return abci.ValidatorUpdate{ - PubKey: TM2PB.PubKey(val.PubKey), + PubKey: pk, Power: val.VotingPower, } } -// XXX: panics on nil or unknown pubkey type -// TODO: add cases when new pubkey types are added to crypto -func (tm2pb) PubKey(pubKey crypto.PubKey) abci.PubKey { - switch pk := pubKey.(type) { - case ed25519.PubKey: - return abci.PubKey{ - Type: ABCIPubKeyTypeEd25519, - Data: pk[:], - } - case sr25519.PubKey: - return abci.PubKey{ - Type: ABCIPubKeyTypeSr25519, - Data: pk[:], - } - case secp256k1.PubKey: - return abci.PubKey{ - Type: ABCIPubKeyTypeSecp256k1, - Data: pk[:], - } - default: - panic(fmt.Sprintf("unknown pubkey type: %v %v", pubKey, reflect.TypeOf(pubKey))) - } -} - // XXX: panics on nil or unknown pubkey type func (tm2pb) ValidatorUpdates(vals *ValidatorSet) []abci.ValidatorUpdate { validators := make([]abci.ValidatorUpdate, vals.Size()) @@ -179,7 +160,10 @@ func (tm2pb) Evidence(ev Evidence, valSet *ValidatorSet, evTime time.Time) abci. // XXX: panics on nil or unknown pubkey type func (tm2pb) NewValidatorUpdate(pubkey crypto.PubKey, power int64) abci.ValidatorUpdate { - pubkeyABCI := TM2PB.PubKey(pubkey) + pubkeyABCI, err := cryptoenc.PubKeyToProto(pubkey) + if err != nil { + panic(err) + } return abci.ValidatorUpdate{ PubKey: pubkeyABCI, Power: power, @@ -194,41 +178,10 @@ var PB2TM = pb2tm{} type pb2tm struct{} -func (pb2tm) PubKey(pubKey abci.PubKey) (crypto.PubKey, error) { - switch pubKey.Type { - case ABCIPubKeyTypeEd25519: - if len(pubKey.Data) != ed25519.PubKeySize { - return nil, fmt.Errorf("invalid size for PubKeyEd25519. Got %d, expected %d", - len(pubKey.Data), ed25519.PubKeySize) - } - 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 = 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 = make(secp256k1.PubKey, secp256k1.PubKeySize) - copy(pk, pubKey.Data) - return pk, nil - default: - return nil, fmt.Errorf("unknown pubkey type %v", pubKey.Type) - } -} - func (pb2tm) ValidatorUpdates(vals []abci.ValidatorUpdate) ([]*Validator, error) { tmVals := make([]*Validator, len(vals)) for i, v := range vals { - pub, err := PB2TM.PubKey(v.PubKey) + pub, err := cryptoenc.PubKeyFromProto(v.PubKey) if err != nil { return nil, err } diff --git a/types/protobuf_test.go b/types/protobuf_test.go index c4ccf6ef2..213b1f303 100644 --- a/types/protobuf_test.go +++ b/types/protobuf_test.go @@ -13,22 +13,23 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/secp256k1" + cryptoenc "github.com/tendermint/tendermint/crypto/encoding" "github.com/tendermint/tendermint/proto/version" ) func TestABCIPubKey(t *testing.T) { pkEd := ed25519.GenPrivKey().PubKey() - pkSecp := secp256k1.GenPrivKey().PubKey() - testABCIPubKey(t, pkEd, ABCIPubKeyTypeEd25519) - testABCIPubKey(t, pkSecp, ABCIPubKeyTypeSecp256k1) + err := testABCIPubKey(t, pkEd, ABCIPubKeyTypeEd25519) + assert.NoError(t, err) } -func testABCIPubKey(t *testing.T, pk crypto.PubKey, typeStr string) { - abciPubKey := TM2PB.PubKey(pk) - pk2, err := PB2TM.PubKey(abciPubKey) - assert.Nil(t, err) - assert.Equal(t, pk, pk2) +func testABCIPubKey(t *testing.T, pk crypto.PubKey, typeStr string) error { + abciPubKey, err := cryptoenc.PubKeyToProto(pk) + require.NoError(t, err) + pk2, err := cryptoenc.PubKeyFromProto(abciPubKey) + require.NoError(t, err) + require.Equal(t, pk, pk2) + return nil } func TestABCIValidators(t *testing.T) { @@ -54,13 +55,6 @@ func TestABCIValidators(t *testing.T) { tmVals, err = PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) assert.Nil(t, err) assert.Equal(t, tmValExpected, tmVals[0]) - - // val with incorrect pubkey data - abciVal = TM2PB.ValidatorUpdate(tmVal) - abciVal.PubKey.Data = []byte("incorrect!") - tmVals, err = PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{abciVal}) - assert.NotNil(t, err) - assert.Nil(t, tmVals) } func TestABCIConsensusParams(t *testing.T) { @@ -154,6 +148,8 @@ func (pubKeyEddie) Address() Address { return []byte{} } func (pubKeyEddie) Bytes() []byte { return []byte{} } func (pubKeyEddie) VerifyBytes(msg []byte, sig []byte) bool { return false } func (pubKeyEddie) Equals(crypto.PubKey) bool { return false } +func (pubKeyEddie) String() string { return "" } +func (pubKeyEddie) Type() string { return "pubKeyEddie" } func TestABCIValidatorFromPubKeyAndPower(t *testing.T) { pubkey := ed25519.GenPrivKey().PubKey()