Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tm pubkey references #7102

Merged
merged 23 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7d2e3d5
Update pubkey references
sahith-narahari Aug 18, 2020
61efbb3
Merge branch 'master' into sahith/update-keys-ref
sahith-narahari Aug 19, 2020
dccf1ef
Update ledger_mock
sahith-narahari Aug 19, 2020
71e415b
Migrate encoding from tm
sahith-narahari Aug 19, 2020
78b1b22
Update pubkey prefix
sahith-narahari Aug 25, 2020
a33dd58
resolve conflicts
tac0turtle Aug 26, 2020
6e28dab
revert ed25519 to tendermint key
tac0turtle Aug 26, 2020
0f58161
random account revert
tac0turtle Aug 26, 2020
9e3af96
Revert ed25519 references
sahith-narahari Aug 26, 2020
ea744da
revert secp key name
tac0turtle Aug 27, 2020
fd2ebe2
test revert
tac0turtle Aug 27, 2020
bc5ebbd
Merge branch 'master' into sahith/update-keys-ref
tac0turtle Aug 27, 2020
66d2e1d
remove ed25519
tac0turtle Aug 27, 2020
be33f1c
Merge branch 'sahith/update-keys-ref' of https://github.com/cosmos/co…
tac0turtle Aug 27, 2020
f1c6fcc
Merge branch 'master' into sahith/update-keys-ref
tac0turtle Aug 27, 2020
00d040c
Update x/staking/types/validator.go
sahith-narahari Aug 28, 2020
42dd530
Revert "remove ed25519"
tac0turtle Aug 28, 2020
1765d16
Merge branch 'master' into sahith/update-keys-ref
tac0turtle Aug 28, 2020
2c1585f
remove ed25519 & sr25519
tac0turtle Aug 28, 2020
bb6ddb2
Merge branch 'sahith/update-keys-ref' of https://github.com/cosmos/co…
tac0turtle Aug 28, 2020
9b97e9c
Apply suggestions from code review
tac0turtle Aug 28, 2020
a6319ae
remove codec
tac0turtle Aug 28, 2020
96d2d4c
Merge branch 'sahith/update-keys-ref' of https://github.com/cosmos/co…
tac0turtle Aug 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/keys/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"github.com/stretchr/testify/require"

"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/secp256k1"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
2 changes: 1 addition & 1 deletion crypto/armor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
"github.com/tendermint/crypto/bcrypt"
tmcrypto "github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/armor"
"github.com/tendermint/tendermint/crypto/secp256k1"
"github.com/tendermint/tendermint/crypto/xsalsa20symmetric"

"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/crypto"
cryptoAmino "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/types"
)

Expand Down
2 changes: 1 addition & 1 deletion crypto/codec/amino.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package codec
import (
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/secp256k1"
"github.com/tendermint/tendermint/crypto/sr25519"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
)

Expand Down
3 changes: 2 additions & 1 deletion crypto/hd/algo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package hd
import (
bip39 "github.com/cosmos/go-bip39"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/secp256k1"

"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
)

// PubKeyType defines an algorithm to derive key-pairs which can be used for cryptographic signing.
Expand Down
2 changes: 1 addition & 1 deletion crypto/hd/fundraiser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
bip39 "github.com/cosmos/go-bip39"

"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/secp256k1"

"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
)

type addrData struct {
Expand Down
2 changes: 1 addition & 1 deletion crypto/keyring/keyring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/stretchr/testify/require"
tmcrypto "github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/secp256k1"

"github.com/cosmos/cosmos-sdk/crypto"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
2 changes: 1 addition & 1 deletion crypto/keyring/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/secp256k1"

"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/crypto/types/multisig"
sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down
2 changes: 1 addition & 1 deletion crypto/keyring/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/tendermint/tendermint/crypto/secp256k1"

"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand Down
27 changes: 0 additions & 27 deletions crypto/keys/ed25519/bench_test.go

This file was deleted.

163 changes: 0 additions & 163 deletions crypto/keys/ed25519/ed25519.go

This file was deleted.

30 changes: 0 additions & 30 deletions crypto/keys/ed25519/ed25519_test.go

This file was deleted.

42 changes: 42 additions & 0 deletions crypto/keys/encoding/codec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package encoding

import (
"errors"
"fmt"

"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
pc "github.com/tendermint/tendermint/proto/tendermint/crypto"
)

// PubKeyToProto takes crypto.PubKey and transforms it to a protobuf Pubkey
func PubKeyToProto(k crypto.PubKey) (pc.PublicKey, error) {
var kp pc.PublicKey
switch k := k.(type) {
case ed25519.PubKey:
kp = pc.PublicKey{
Sum: &pc.PublicKey_Ed25519{
Ed25519: k,
},
}
default:
return kp, fmt.Errorf("toproto: key type %v is not supported", k)
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
}
return kp, nil
}

// PubKeyFromProto takes a protobuf Pubkey and transforms it to a crypto.Pubkey
func PubKeyFromProto(k pc.PublicKey) (crypto.PubKey, error) {
switch k := k.Sum.(type) {
case *pc.PublicKey_Ed25519:
if len(k.Ed25519) != ed25519.PubKeySize {
return nil, fmt.Errorf("invalid size for PubKeyEd25519. Got %d, expected %d",
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
len(k.Ed25519), ed25519.PubKeySize)
}
pk := make(ed25519.PubKey, ed25519.PubKeySize)
copy(pk, k.Ed25519)
return pk, nil
default:
return nil, fmt.Errorf("fromproto: key type %v is not supported", k)
tac0turtle marked this conversation as resolved.
Show resolved Hide resolved
}
}
2 changes: 2 additions & 0 deletions crypto/keys/secp256k1/secp256k1.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var _ crypto.PrivKey = PrivKey{}
const (
PrivKeySize = 32
keyType = "secp256k1"
PrivKeyName = "tendermint/PrivKeySecp256k1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to keep backwards compatibility

PubKeyName = "tendermint/PubKeySecp256k1"
)

// PrivKey implements PrivKey.
Expand Down
2 changes: 1 addition & 1 deletion crypto/keys/secp256k1/secp256k1_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
package secp256k1

import (
"github.com/cosmos/cosmos-sdk/crypto/secp256k1/internal/secp256k1"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/secp256k1/internal/secp256k1"
)

// Sign creates an ECDSA signature on curve Secp256k1, using SHA256 on the msg.
Expand Down
3 changes: 2 additions & 1 deletion crypto/keys/secp256k1/secp256k1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (
"github.com/stretchr/testify/require"

"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/secp256k1"

underlyingSecp256k1 "github.com/btcsuite/btcd/btcec"

"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
)

type keyData struct {
Expand Down
Loading