Update to tendermint v0.22.6 (#1798)
* Update to tendermint v0.22.6 - This was cherry-picked and fixed from develop - Updates all crypto imports for changes from v0.22.5
This commit is contained in:
parent
029da74eff
commit
bac91f7a7b
|
@ -42,12 +42,11 @@
|
|||
revision = "fdfc19097e7ac6b57035062056f5b7b4638b8898"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:386de157f7d19259a7f9c81f26ce011223ce0f090353c1152ffdf730d7d10ac2"
|
||||
name = "github.com/btcsuite/btcutil"
|
||||
packages = ["bech32"]
|
||||
pruneopts = "UT"
|
||||
revision = "ab6388e0c60ae4834a1f57511e20c17b5f78be4b"
|
||||
revision = "d4cc87b860166d00d6b5b9e0d3b3d71d6088d4d4"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a2c1d0e43bd3baaa071d1b9ed72c27d78169b2b269f71c105ac4ba34b1be4a39"
|
||||
|
@ -58,7 +57,6 @@
|
|||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:c7644c73a3d23741fdba8a99b1464e021a224b7e205be497271a8003a15ca41b"
|
||||
name = "github.com/ebuchman/fail-test"
|
||||
packages = ["."]
|
||||
|
@ -106,7 +104,7 @@
|
|||
version = "v1.7.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:af1306bff89268721ea2550d504413c9487ebfca11e2ff8f39ae79b99a720ff5"
|
||||
digest = "1:212285efb97b9ec2e20550d81f0446cb7897e57cbdfd7301b1363ab113d8be45"
|
||||
name = "github.com/gogo/protobuf"
|
||||
packages = [
|
||||
"gogoproto",
|
||||
|
@ -117,8 +115,8 @@
|
|||
"types",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "1adfc126b41513cc696b209667c8656ea7aac67c"
|
||||
version = "v1.0.0"
|
||||
revision = "636bf0302bc95575d69441b25a2603156ffdddf1"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:cb22af0ed7c72d495d8be1106233ee553898950f15fd3f5404406d44c2e86888"
|
||||
|
@ -265,7 +263,6 @@
|
|||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:98225904b7abff96c052b669b25788f18225a36673fba022fb93514bb9a2a64e"
|
||||
name = "github.com/prometheus/client_golang"
|
||||
packages = [
|
||||
|
@ -309,7 +306,6 @@
|
|||
revision = "ae68e2d4c00fed4943b5f6698d504a5fe083da8a"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:c4556a44e350b50a490544d9b06e9fba9c286c21d6c0e47f54f3a9214597298c"
|
||||
name = "github.com/rcrowley/go-metrics"
|
||||
packages = ["."]
|
||||
|
@ -428,7 +424,7 @@
|
|||
version = "v0.9.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:2511fa7bc2725251a1a48a923c8f01cd41de29b00a21224092d448a9e4627c21"
|
||||
digest = "1:049c779b867a182cea567c65d7c81e3b9e4e4a7eece4c35a19639f75d2aa7da9"
|
||||
name = "github.com/tendermint/tendermint"
|
||||
packages = [
|
||||
"abci/client",
|
||||
|
@ -442,8 +438,13 @@
|
|||
"consensus",
|
||||
"consensus/types",
|
||||
"crypto",
|
||||
"crypto/armor",
|
||||
"crypto/ed25519",
|
||||
"crypto/encoding/amino",
|
||||
"crypto/merkle",
|
||||
"crypto/secp256k1",
|
||||
"crypto/tmhash",
|
||||
"crypto/xsalsa20symmetric",
|
||||
"evidence",
|
||||
"libs/autofile",
|
||||
"libs/bech32",
|
||||
|
@ -486,8 +487,8 @@
|
|||
"version",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "5ff65274b84ea905787a48512cc3124385bddf2f"
|
||||
version = "v0.22.2"
|
||||
revision = "5fdbcd70df57b71ffba71e1ff5f00d617852a9c0"
|
||||
version = "v0.22.6"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5bd938386bd1f61a581bf8cd6ff2b7b2f79c542929176db4ceb44965440dae07"
|
||||
|
@ -517,7 +518,6 @@
|
|||
revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:04dda8391c3e2397daf254ac68003f30141c069b228d06baec8324a5f81dc1e9"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
|
@ -573,7 +573,7 @@
|
|||
revision = "e92b116572682a5b432ddd840aeaba2a559eeff1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:4d7b5d9746840266938cdb21a40f8eba7137d9153c4ed404d6bb2a450d06f690"
|
||||
digest = "1:4515e3030c440845b046354fd5d57671238428b820deebce2e9dabb5cd3c51ac"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -585,9 +585,11 @@
|
|||
"credentials",
|
||||
"encoding",
|
||||
"encoding/proto",
|
||||
"grpclb/grpc_lb_v1/messages",
|
||||
"grpclog",
|
||||
"internal",
|
||||
"internal/backoff",
|
||||
"internal/channelz",
|
||||
"internal/grpcrand",
|
||||
"keepalive",
|
||||
"metadata",
|
||||
"naming",
|
||||
|
@ -601,8 +603,8 @@
|
|||
"transport",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "d11072e7ca9811b1100b80ca0269ac831f06d024"
|
||||
version = "v1.11.3"
|
||||
revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8"
|
||||
version = "v1.13.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:342378ac4dcb378a5448dd723f0784ae519383532f5e70ade24132c4c8693202"
|
||||
|
@ -635,8 +637,13 @@
|
|||
"github.com/tendermint/tendermint/cmd/tendermint/commands",
|
||||
"github.com/tendermint/tendermint/config",
|
||||
"github.com/tendermint/tendermint/crypto",
|
||||
"github.com/tendermint/tendermint/crypto/armor",
|
||||
"github.com/tendermint/tendermint/crypto/ed25519",
|
||||
"github.com/tendermint/tendermint/crypto/encoding/amino",
|
||||
"github.com/tendermint/tendermint/crypto/merkle",
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1",
|
||||
"github.com/tendermint/tendermint/crypto/tmhash",
|
||||
"github.com/tendermint/tendermint/crypto/xsalsa20symmetric",
|
||||
"github.com/tendermint/tendermint/libs/bech32",
|
||||
"github.com/tendermint/tendermint/libs/cli",
|
||||
"github.com/tendermint/tendermint/libs/cli/flags",
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
[[override]]
|
||||
name = "github.com/tendermint/tendermint"
|
||||
version = "=0.22.2"
|
||||
version = "=v0.22.6"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/bartekn/go-bip39"
|
||||
|
|
|
@ -19,6 +19,7 @@ import (
|
|||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
tmcfg "github.com/tendermint/tendermint/config"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
"github.com/tendermint/tendermint/libs/cli"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
@ -119,7 +120,7 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress
|
|||
for i := 1; i < nValidators; i++ {
|
||||
genDoc.Validators = append(genDoc.Validators,
|
||||
tmtypes.GenesisValidator{
|
||||
PubKey: crypto.GenPrivKeyEd25519().PubKey(),
|
||||
PubKey: ed25519.GenPrivKey().PubKey(),
|
||||
Power: 1,
|
||||
Name: "val",
|
||||
},
|
||||
|
@ -151,7 +152,7 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress
|
|||
|
||||
appState, err := wire.MarshalJSONIndent(cdc, genesisState)
|
||||
require.NoError(t, err)
|
||||
genDoc.AppStateJSON = appState
|
||||
genDoc.AppState = appState
|
||||
|
||||
// LCD listen address
|
||||
var listenAddr string
|
||||
|
|
|
@ -6,11 +6,11 @@ import (
|
|||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
func TestToAccount(t *testing.T) {
|
||||
priv := crypto.GenPrivKeyEd25519()
|
||||
priv := ed25519.GenPrivKey()
|
||||
addr := sdk.AccAddress(priv.PubKey().Address())
|
||||
authAcc := auth.NewBaseAccountWithAddress(addr)
|
||||
genAcc := NewGenesisAccount(&authAcc)
|
||||
|
|
|
@ -12,7 +12,8 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
@ -94,9 +95,9 @@ func runHackCmd(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
}
|
||||
|
||||
func base64ToPub(b64 string) crypto.PubKeyEd25519 {
|
||||
func base64ToPub(b64 string) ed25519.PubKeyEd25519 {
|
||||
data, _ := base64.StdEncoding.DecodeString(b64)
|
||||
var pubKey crypto.PubKeyEd25519
|
||||
var pubKey ed25519.PubKeyEd25519
|
||||
copy(pubKey[:], data)
|
||||
return pubKey
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -116,11 +117,11 @@ func runPubKeyCmd(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
}
|
||||
|
||||
var pubKey crypto.PubKeyEd25519
|
||||
var pubKey ed25519.PubKeyEd25519
|
||||
if pubKeyI == nil {
|
||||
copy(pubKey[:], pubkeyBytes)
|
||||
} else {
|
||||
pubKey = pubKeyI.(crypto.PubKeyEd25519)
|
||||
pubKey = pubKeyI.(ed25519.PubKeyEd25519)
|
||||
pubkeyBytes = pubKey[:]
|
||||
}
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@ package crypto
|
|||
|
||||
import (
|
||||
"github.com/tendermint/go-amino"
|
||||
tcrypto "github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
)
|
||||
|
||||
var cdc = amino.NewCodec()
|
||||
|
||||
func init() {
|
||||
RegisterAmino(cdc)
|
||||
tcrypto.RegisterAmino(cdc)
|
||||
cryptoAmino.RegisterAmino(cdc)
|
||||
}
|
||||
|
||||
// RegisterAmino registers all go-crypto related types in the given (amino) codec.
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package crypto
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
tcrypto "github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
)
|
||||
|
||||
type byter interface {
|
||||
|
@ -62,12 +65,12 @@ func TestKeyEncodings(t *testing.T) {
|
|||
privSize, pubSize int // binary sizes with the amino overhead
|
||||
}{
|
||||
{
|
||||
privKey: tcrypto.GenPrivKeyEd25519(),
|
||||
privKey: ed25519.GenPrivKey(),
|
||||
privSize: 69,
|
||||
pubSize: 37,
|
||||
},
|
||||
{
|
||||
privKey: tcrypto.GenPrivKeySecp256k1(),
|
||||
privKey: secp256k1.GenPrivKey(),
|
||||
privSize: 37,
|
||||
pubSize: 38,
|
||||
},
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
)
|
||||
|
||||
type addrData struct {
|
||||
|
@ -57,7 +58,7 @@ func TestFundraiserCompatibility(t *testing.T) {
|
|||
master, ch := ComputeMastersFromSeed(seed)
|
||||
priv, err := DerivePrivateKeyForPath(master, ch, "44'/118'/0'/0/0")
|
||||
require.NoError(t, err)
|
||||
pub := crypto.PrivKeySecp256k1(priv).PubKey()
|
||||
pub := secp256k1.PrivKeySecp256k1(priv).PubKey()
|
||||
|
||||
t.Log("\tNODEJS GOLANG\n")
|
||||
t.Logf("SEED \t%X %X\n", seedB, seed)
|
||||
|
@ -70,7 +71,7 @@ func TestFundraiserCompatibility(t *testing.T) {
|
|||
require.Equal(t, priv[:], privB, "Expected priv keys to match")
|
||||
var pubBFixed [33]byte
|
||||
copy(pubBFixed[:], pubB)
|
||||
require.Equal(t, pub, crypto.PubKeySecp256k1(pubBFixed), fmt.Sprintf("Expected pub keys to match for %d", i))
|
||||
require.Equal(t, pub, secp256k1.PubKeySecp256k1(pubBFixed), fmt.Sprintf("Expected pub keys to match for %d", i))
|
||||
|
||||
addr := pub.Address()
|
||||
t.Logf("ADDR \t%X %X\n", addrB, addr)
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
)
|
||||
|
||||
// BIP44Prefix is the parts of the BIP32 HD path that are fixed by what we used during the fundraiser.
|
||||
|
@ -128,9 +128,9 @@ func derivePrivateKey(privKeyBytes [32]byte, chainCode [32]byte, index uint32, h
|
|||
data = append([]byte{byte(0)}, privKeyBytes[:]...)
|
||||
} else {
|
||||
// this can't return an error:
|
||||
pubkey := crypto.PrivKeySecp256k1(privKeyBytes).PubKey()
|
||||
pubkey := secp256k1.PrivKeySecp256k1(privKeyBytes).PubKey()
|
||||
|
||||
public := pubkey.(crypto.PubKeySecp256k1)
|
||||
public := pubkey.(secp256k1.PubKeySecp256k1)
|
||||
data = public[:]
|
||||
}
|
||||
data = append(data, uint32ToBytes(index)...)
|
||||
|
|
|
@ -11,6 +11,8 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/crypto/keys/hd"
|
||||
"github.com/pkg/errors"
|
||||
tmcrypto "github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
"github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
)
|
||||
|
||||
|
@ -163,9 +165,9 @@ func (kb *dbKeybase) persistDerivedKey(seed []byte, passwd, name, fullHdPath str
|
|||
// if we have a password, use it to encrypt the private key and store it
|
||||
// else store the public key only
|
||||
if passwd != "" {
|
||||
info = kb.writeLocalKey(tmcrypto.PrivKeySecp256k1(derivedPriv), name, passwd)
|
||||
info = kb.writeLocalKey(secp256k1.PrivKeySecp256k1(derivedPriv), name, passwd)
|
||||
} else {
|
||||
pubk := tmcrypto.PrivKeySecp256k1(derivedPriv).PubKey()
|
||||
pubk := secp256k1.PrivKeySecp256k1(derivedPriv).PubKey()
|
||||
info = kb.writeOfflineKey(pubk, name)
|
||||
}
|
||||
return
|
||||
|
@ -314,7 +316,7 @@ func (kb dbKeybase) ImportPubKey(name string, armor string) (err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
pubKey, err := tmcrypto.PubKeyFromBytes(pubBytes)
|
||||
pubKey, err := cryptoAmino.PubKeyFromBytes(pubBytes)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
)
|
||||
|
@ -69,7 +70,7 @@ func TestKeyManagement(t *testing.T) {
|
|||
|
||||
// create an offline key
|
||||
o1 := "offline"
|
||||
priv1 := crypto.GenPrivKeyEd25519()
|
||||
priv1 := ed25519.GenPrivKey()
|
||||
pub1 := priv1.PubKey()
|
||||
i, err = cstore.CreateOffline(o1, pub1)
|
||||
require.Nil(t, err)
|
||||
|
|
|
@ -8,6 +8,9 @@ import (
|
|||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/bcrypt"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/armor"
|
||||
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
"github.com/tendermint/tendermint/crypto/xsalsa20symmetric"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -44,7 +47,7 @@ func armorBytes(bz []byte, blockType string) string {
|
|||
"type": "Info",
|
||||
"version": "0.0.0",
|
||||
}
|
||||
return crypto.EncodeArmor(blockType, header, bz)
|
||||
return armor.EncodeArmor(blockType, header, bz)
|
||||
}
|
||||
|
||||
func unarmorInfoBytes(armorStr string) (bz []byte, err error) {
|
||||
|
@ -56,7 +59,7 @@ func unarmorPubKeyBytes(armorStr string) (bz []byte, err error) {
|
|||
}
|
||||
|
||||
func unarmorBytes(armorStr, blockType string) (bz []byte, err error) {
|
||||
bType, header, bz, err := crypto.DecodeArmor(armorStr)
|
||||
bType, header, bz, err := armor.DecodeArmor(armorStr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -77,13 +80,13 @@ func encryptArmorPrivKey(privKey crypto.PrivKey, passphrase string) string {
|
|||
"kdf": "bcrypt",
|
||||
"salt": fmt.Sprintf("%X", saltBytes),
|
||||
}
|
||||
armorStr := crypto.EncodeArmor(blockTypePrivKey, header, encBytes)
|
||||
armorStr := armor.EncodeArmor(blockTypePrivKey, header, encBytes)
|
||||
return armorStr
|
||||
}
|
||||
|
||||
func unarmorDecryptPrivKey(armorStr string, passphrase string) (crypto.PrivKey, error) {
|
||||
var privKey crypto.PrivKey
|
||||
blockType, header, encBytes, err := crypto.DecodeArmor(armorStr)
|
||||
blockType, header, encBytes, err := armor.DecodeArmor(armorStr)
|
||||
if err != nil {
|
||||
return privKey, err
|
||||
}
|
||||
|
@ -112,7 +115,7 @@ func encryptPrivKey(privKey crypto.PrivKey, passphrase string) (saltBytes []byte
|
|||
}
|
||||
key = crypto.Sha256(key) // Get 32 bytes
|
||||
privKeyBytes := privKey.Bytes()
|
||||
return saltBytes, crypto.EncryptSymmetric(privKeyBytes, key)
|
||||
return saltBytes, xsalsa20symmetric.EncryptSymmetric(privKeyBytes, key)
|
||||
}
|
||||
|
||||
func decryptPrivKey(saltBytes []byte, encBytes []byte, passphrase string) (privKey crypto.PrivKey, err error) {
|
||||
|
@ -121,10 +124,10 @@ func decryptPrivKey(saltBytes []byte, encBytes []byte, passphrase string) (privK
|
|||
cmn.Exit("Error generating bcrypt key from passphrase: " + err.Error())
|
||||
}
|
||||
key = crypto.Sha256(key) // Get 32 bytes
|
||||
privKeyBytes, err := crypto.DecryptSymmetric(encBytes, key)
|
||||
privKeyBytes, err := xsalsa20symmetric.DecryptSymmetric(encBytes, key)
|
||||
if err != nil {
|
||||
return privKey, err
|
||||
}
|
||||
privKey, err = crypto.PrivKeyFromBytes(privKeyBytes)
|
||||
privKey, err = cryptoAmino.PrivKeyFromBytes(privKeyBytes)
|
||||
return privKey, err
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@ package keys
|
|||
import (
|
||||
ccrypto "github.com/cosmos/cosmos-sdk/crypto"
|
||||
amino "github.com/tendermint/go-amino"
|
||||
tcrypto "github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
)
|
||||
|
||||
var cdc = amino.NewCodec()
|
||||
|
||||
func init() {
|
||||
tcrypto.RegisterAmino(cdc)
|
||||
cryptoAmino.RegisterAmino(cdc)
|
||||
cdc.RegisterInterface((*Info)(nil), nil)
|
||||
cdc.RegisterConcrete(ccrypto.PrivKeyLedgerSecp256k1{},
|
||||
"tendermint/PrivKeyLedgerSecp256k1", nil)
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
secp256k1 "github.com/btcsuite/btcd/btcec"
|
||||
tmcrypto "github.com/tendermint/tendermint/crypto"
|
||||
tmsecp256k1 "github.com/tendermint/tendermint/crypto/secp256k1"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -140,7 +141,7 @@ func (pkl PrivKeyLedgerSecp256k1) signLedgerSecp256k1(msg []byte) (tmcrypto.Sign
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return tmcrypto.SignatureSecp256k1FromBytes(sigBytes), nil
|
||||
return tmsecp256k1.SignatureSecp256k1FromBytes(sigBytes), nil
|
||||
}
|
||||
|
||||
func (pkl PrivKeyLedgerSecp256k1) pubkeyLedgerSecp256k1() (pub tmcrypto.PubKey, err error) {
|
||||
|
@ -149,7 +150,7 @@ func (pkl PrivKeyLedgerSecp256k1) pubkeyLedgerSecp256k1() (pub tmcrypto.PubKey,
|
|||
return nil, fmt.Errorf("error fetching public key: %v", err)
|
||||
}
|
||||
|
||||
var pk tmcrypto.PubKeySecp256k1
|
||||
var pk tmsecp256k1.PubKeySecp256k1
|
||||
|
||||
// re-serialize in the 33-byte compressed format
|
||||
cmp, err := secp256k1.ParsePubKey(key[:], secp256k1.S256())
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
tmcrypto "github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
)
|
||||
|
||||
var ledgerEnabledEnv = "TEST_WITH_LEDGER"
|
||||
|
@ -30,7 +30,7 @@ func TestRealLedgerSecp256k1(t *testing.T) {
|
|||
|
||||
// now, let's serialize the public key and make sure it still works
|
||||
bs := priv.PubKey().Bytes()
|
||||
pub2, err := tmcrypto.PubKeyFromBytes(bs)
|
||||
pub2, err := cryptoAmino.PubKeyFromBytes(bs)
|
||||
require.Nil(t, err, "%+v", err)
|
||||
|
||||
// make sure we get the same pubkey when we load from disk
|
||||
|
@ -44,7 +44,7 @@ func TestRealLedgerSecp256k1(t *testing.T) {
|
|||
|
||||
// make sure pubkeys serialize properly as well
|
||||
bs = pub.Bytes()
|
||||
bpub, err := tmcrypto.PubKeyFromBytes(bs)
|
||||
bpub, err := cryptoAmino.PubKeyFromBytes(bs)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, pub, bpub)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
@ -21,7 +21,7 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
issuer = crypto.GenPrivKeyEd25519().PubKey().Address()
|
||||
issuer = ed25519.GenPrivKey().PubKey().Address()
|
||||
)
|
||||
|
||||
func NewCodec() *wire.Codec {
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
)
|
||||
|
@ -42,7 +42,7 @@ func TestGenesis(t *testing.T) {
|
|||
baseApp := NewBasecoinApp(logger, db)
|
||||
|
||||
// construct a pubkey and an address for the test account
|
||||
pubkey := crypto.GenPrivKeyEd25519().PubKey()
|
||||
pubkey := ed25519.GenPrivKey().PubKey()
|
||||
addr := sdk.AccAddress(pubkey.Address())
|
||||
|
||||
// construct some test coins
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
)
|
||||
|
@ -46,7 +46,7 @@ func TestGenesis(t *testing.T) {
|
|||
bapp := NewDemocoinApp(logger, db)
|
||||
|
||||
// Construct some genesis bytes to reflect democoin/types/AppAccount
|
||||
pk := crypto.GenPrivKeyEd25519().PubKey()
|
||||
pk := ed25519.GenPrivKey().PubKey()
|
||||
addr := sdk.AccAddress(pk.Address())
|
||||
coins, err := sdk.ParseCoins("77foocoin,99barcoin")
|
||||
require.Nil(t, err)
|
||||
|
|
|
@ -9,11 +9,11 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
var (
|
||||
priv1 = crypto.GenPrivKeyEd25519()
|
||||
priv1 = ed25519.GenPrivKey()
|
||||
pubKey = priv1.PubKey()
|
||||
addr1 = sdk.AccAddress(pubKey.Address())
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/mock"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
var (
|
||||
priv1 = crypto.GenPrivKeyEd25519()
|
||||
priv1 = ed25519.GenPrivKey()
|
||||
addr1 = sdk.AccAddress(priv1.PubKey().Address())
|
||||
)
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client/context"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
@ -55,7 +55,7 @@ func BondTxCmd(cdc *wire.Codec) *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var pubKeyEd crypto.PubKeyEd25519
|
||||
var pubKeyEd ed25519.PubKeyEd25519
|
||||
copy(pubKeyEd[:], rawPubKey)
|
||||
|
||||
msg := simplestake.NewMsgBond(from, stake, pubKeyEd)
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
|
@ -43,7 +43,7 @@ func TestKeeperGetSet(t *testing.T) {
|
|||
bi := stakeKeeper.getBondInfo(ctx, addr)
|
||||
require.Equal(t, bi, bondInfo{})
|
||||
|
||||
privKey := crypto.GenPrivKeyEd25519()
|
||||
privKey := ed25519.GenPrivKey()
|
||||
|
||||
bi = bondInfo{
|
||||
PubKey: privKey.PubKey(),
|
||||
|
@ -69,7 +69,7 @@ func TestBonding(t *testing.T) {
|
|||
coinKeeper := bank.NewKeeper(accountMapper)
|
||||
stakeKeeper := NewKeeper(capKey, coinKeeper, DefaultCodespace)
|
||||
addr := sdk.AccAddress([]byte("some-address"))
|
||||
privKey := crypto.GenPrivKeyEd25519()
|
||||
privKey := ed25519.GenPrivKey()
|
||||
pubKey := privKey.PubKey()
|
||||
|
||||
_, _, err := stakeKeeper.unbondWithoutCoins(ctx, addr)
|
||||
|
|
|
@ -4,14 +4,13 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func TestBondMsgValidation(t *testing.T) {
|
||||
privKey := crypto.GenPrivKeyEd25519()
|
||||
privKey := ed25519.GenPrivKey()
|
||||
cases := []struct {
|
||||
valid bool
|
||||
msgBond MsgBond
|
||||
|
|
|
@ -30,7 +30,7 @@ func ExportCmd(ctx *Context, cdc *wire.Codec, appExporter AppExporter) *cobra.Co
|
|||
return err
|
||||
}
|
||||
|
||||
doc.AppStateJSON = appState
|
||||
doc.AppState = appState
|
||||
doc.Validators = validators
|
||||
|
||||
encoded, err := wire.MarshalJSONIndent(cdc, doc)
|
||||
|
|
|
@ -346,9 +346,9 @@ func readOrCreatePrivValidator(tmConfig *cfg.Config) crypto.PubKey {
|
|||
// error is returned if building or writing the configuration to file fails.
|
||||
func writeGenesisFile(cdc *wire.Codec, genesisFile, chainID string, validators []tmtypes.GenesisValidator, appState json.RawMessage) error {
|
||||
genDoc := tmtypes.GenesisDoc{
|
||||
ChainID: chainID,
|
||||
Validators: validators,
|
||||
AppStateJSON: appState,
|
||||
ChainID: chainID,
|
||||
Validators: validators,
|
||||
AppState: appState,
|
||||
}
|
||||
|
||||
if err := genDoc.ValidateAndComplete(); err != nil {
|
||||
|
|
|
@ -7,6 +7,8 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
|
||||
"github.com/tendermint/tendermint/libs/bech32"
|
||||
)
|
||||
|
||||
|
@ -225,7 +227,7 @@ func GetAccPubKeyBech32(address string) (pk crypto.PubKey, err error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
pk, err = crypto.PubKeyFromBytes(bz)
|
||||
pk, err = cryptoAmino.PubKeyFromBytes(bz)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -249,7 +251,7 @@ func GetValPubKeyBech32(pubkey string) (pk crypto.PubKey, err error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
pk, err = crypto.PubKeyFromBytes(bz)
|
||||
pk, err = cryptoAmino.PubKeyFromBytes(bz)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
|
||||
amino "github.com/tendermint/go-amino"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||
)
|
||||
|
||||
// amino codec to marshal/unmarshal
|
||||
|
@ -18,7 +18,7 @@ func NewCodec() *Codec {
|
|||
|
||||
// Register the go-crypto to the codec
|
||||
func RegisterCrypto(cdc *Codec) {
|
||||
crypto.RegisterAmino(cdc)
|
||||
cryptoAmino.RegisterAmino(cdc)
|
||||
}
|
||||
|
||||
// attempt to make some pretty json
|
||||
|
|
|
@ -6,13 +6,14 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
wire "github.com/cosmos/cosmos-sdk/wire"
|
||||
)
|
||||
|
||||
func keyPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress) {
|
||||
key := crypto.GenPrivKeyEd25519()
|
||||
key := ed25519.GenPrivKey()
|
||||
pub := key.PubKey()
|
||||
addr := sdk.AccAddress(pub.Address())
|
||||
return key, pub, addr
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
@ -32,7 +33,7 @@ func newCoins() sdk.Coins {
|
|||
|
||||
// generate a priv key and return it with its address
|
||||
func privAndAddr() (crypto.PrivKey, sdk.AccAddress) {
|
||||
priv := crypto.GenPrivKeyEd25519()
|
||||
priv := ed25519.GenPrivKey()
|
||||
addr := sdk.AccAddress(priv.PubKey().Address())
|
||||
return priv, addr
|
||||
}
|
||||
|
|
|
@ -5,14 +5,13 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
func TestStdTx(t *testing.T) {
|
||||
priv := crypto.GenPrivKeyEd25519()
|
||||
priv := ed25519.GenPrivKey()
|
||||
addr := sdk.AccAddress(priv.PubKey().Address())
|
||||
msgs := []sdk.Msg{sdk.NewTestMsg(addr)}
|
||||
fee := newStdFee()
|
||||
|
@ -27,7 +26,7 @@ func TestStdTx(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestStdSignBytes(t *testing.T) {
|
||||
priv := crypto.GenPrivKeyEd25519()
|
||||
priv := ed25519.GenPrivKey()
|
||||
addr := sdk.AccAddress(priv.PubKey().Address())
|
||||
msgs := []sdk.Msg{sdk.NewTestMsg(addr)}
|
||||
fee := newStdFee()
|
||||
|
|
|
@ -13,17 +13,19 @@ import (
|
|||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
// test bank module in a mock application
|
||||
var (
|
||||
priv1 = crypto.GenPrivKeyEd25519()
|
||||
addr1 = sdk.AccAddress(priv1.PubKey().Address())
|
||||
priv2 = crypto.GenPrivKeyEd25519()
|
||||
addr2 = sdk.AccAddress(priv2.PubKey().Address())
|
||||
addr3 = sdk.AccAddress(crypto.GenPrivKeyEd25519().PubKey().Address())
|
||||
priv4 = crypto.GenPrivKeyEd25519()
|
||||
addr4 = sdk.AccAddress(priv4.PubKey().Address())
|
||||
priv1 = ed25519.GenPrivKey()
|
||||
addr1 = sdk.AccAddress(priv1.PubKey().Address())
|
||||
priv2 = ed25519.GenPrivKey()
|
||||
addr2 = sdk.AccAddress(priv2.PubKey().Address())
|
||||
addr3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address())
|
||||
priv4 = ed25519.GenPrivKey()
|
||||
addr4 = sdk.AccAddress(priv4.PubKey().Address())
|
||||
|
||||
coins = sdk.Coins{sdk.NewCoin("foocoin", 10)}
|
||||
halfCoins = sdk.Coins{sdk.NewCoin("foocoin", 5)}
|
||||
manyCoins = sdk.Coins{sdk.NewCoin("foocoin", 1), sdk.NewCoin("barcoin", 1)}
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/x/stake"
|
||||
)
|
||||
|
@ -19,9 +19,9 @@ func TestTallyNoOneVotes(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
|
||||
proposal := keeper.NewTextProposal(ctx, "Test", "description", ProposalTypeText)
|
||||
|
@ -41,10 +41,10 @@ func TestTallyOnlyValidatorsAllYes(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
res := stakeHandler(ctx, val1CreateMsg)
|
||||
require.True(t, res.IsOK())
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
res = stakeHandler(ctx, val2CreateMsg)
|
||||
require.True(t, res.IsOK())
|
||||
|
||||
|
@ -70,9 +70,9 @@ func TestTallyOnlyValidators51No(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
|
||||
proposal := keeper.NewTextProposal(ctx, "Test", "description", ProposalTypeText)
|
||||
|
@ -97,11 +97,11 @@ func TestTallyOnlyValidators51Yes(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
stakeHandler(ctx, val3CreateMsg)
|
||||
|
||||
proposal := keeper.NewTextProposal(ctx, "Test", "description", ProposalTypeText)
|
||||
|
@ -128,11 +128,11 @@ func TestTallyOnlyValidatorsVetoed(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
stakeHandler(ctx, val3CreateMsg)
|
||||
|
||||
proposal := keeper.NewTextProposal(ctx, "Test", "description", ProposalTypeText)
|
||||
|
@ -159,11 +159,11 @@ func TestTallyOnlyValidatorsAbstainPasses(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
stakeHandler(ctx, val3CreateMsg)
|
||||
|
||||
proposal := keeper.NewTextProposal(ctx, "Test", "description", ProposalTypeText)
|
||||
|
@ -190,11 +190,11 @@ func TestTallyOnlyValidatorsAbstainFails(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
stakeHandler(ctx, val3CreateMsg)
|
||||
|
||||
proposal := keeper.NewTextProposal(ctx, "Test", "description", ProposalTypeText)
|
||||
|
@ -221,11 +221,11 @@ func TestTallyOnlyValidatorsNonVoter(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
stakeHandler(ctx, val3CreateMsg)
|
||||
|
||||
proposal := keeper.NewTextProposal(ctx, "Test", "description", ProposalTypeText)
|
||||
|
@ -252,11 +252,11 @@ func TestTallyDelgatorOverride(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
stakeHandler(ctx, val3CreateMsg)
|
||||
|
||||
delegator1Msg := stake.NewMsgDelegate(addrs[3], addrs[2], sdk.NewCoin("steak", 30))
|
||||
|
@ -288,11 +288,11 @@ func TestTallyDelgatorInherit(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
stakeHandler(ctx, val3CreateMsg)
|
||||
|
||||
delegator1Msg := stake.NewMsgDelegate(addrs[3], addrs[2], sdk.NewCoin("steak", 30))
|
||||
|
@ -323,11 +323,11 @@ func TestTallyDelgatorMultipleOverride(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 5), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
stakeHandler(ctx, val3CreateMsg)
|
||||
|
||||
delegator1Msg := stake.NewMsgDelegate(addrs[3], addrs[2], sdk.NewCoin("steak", 10))
|
||||
|
@ -361,11 +361,11 @@ func TestTallyDelgatorMultipleInherit(t *testing.T) {
|
|||
stakeHandler := stake.NewHandler(sk)
|
||||
|
||||
dummyDescription := stake.NewDescription("T", "E", "S", "T")
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 25), dummyDescription)
|
||||
val1CreateMsg := stake.NewMsgCreateValidator(addrs[0], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 25), dummyDescription)
|
||||
stakeHandler(ctx, val1CreateMsg)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
val2CreateMsg := stake.NewMsgCreateValidator(addrs[1], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 6), dummyDescription)
|
||||
stakeHandler(ctx, val2CreateMsg)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], crypto.GenPrivKeyEd25519().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
val3CreateMsg := stake.NewMsgCreateValidator(addrs[2], ed25519.GenPrivKey().PubKey(), sdk.NewCoin("steak", 7), dummyDescription)
|
||||
stakeHandler(ctx, val3CreateMsg)
|
||||
|
||||
delegator1Msg := stake.NewMsgDelegate(addrs[3], addrs[2], sdk.NewCoin("steak", 10))
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/mock"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
// initialize the mock application for this module
|
||||
|
@ -34,7 +34,7 @@ func TestIBCMsgs(t *testing.T) {
|
|||
sourceChain := "source-chain"
|
||||
destChain := "dest-chain"
|
||||
|
||||
priv1 := crypto.GenPrivKeyEd25519()
|
||||
priv1 := ed25519.GenPrivKey()
|
||||
addr1 := sdk.AccAddress(priv1.PubKey().Address())
|
||||
coins := sdk.Coins{sdk.NewCoin("foocoin", 10)}
|
||||
var emptyCoins sdk.Coins
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
|
@ -29,7 +29,7 @@ func defaultContext(key sdk.StoreKey) sdk.Context {
|
|||
}
|
||||
|
||||
func newAddress() sdk.AccAddress {
|
||||
return sdk.AccAddress(crypto.GenPrivKeyEd25519().PubKey().Address())
|
||||
return sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address())
|
||||
}
|
||||
|
||||
func getCoins(ck bank.Keeper, ctx sdk.Context, addr sdk.AccAddress) (sdk.Coins, sdk.Error) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
)
|
||||
|
@ -97,7 +98,7 @@ func (app *App) InitChainer(ctx sdk.Context, _ abci.RequestInitChain) abci.Respo
|
|||
// their addresses, pubkeys, and privkeys.
|
||||
func CreateGenAccounts(numAccs int, genCoins sdk.Coins) (genAccs []auth.Account, addrs []sdk.AccAddress, pubKeys []crypto.PubKey, privKeys []crypto.PrivKey) {
|
||||
for i := 0; i < numAccs; i++ {
|
||||
privKey := crypto.GenPrivKeyEd25519()
|
||||
privKey := ed25519.GenPrivKey()
|
||||
pubKey := privKey.PubKey()
|
||||
addr := sdk.AccAddress(pubKey.Address())
|
||||
|
||||
|
@ -158,7 +159,7 @@ func GeneratePrivKeys(n int) (keys []crypto.PrivKey) {
|
|||
// TODO: Randomize this between ed25519 and secp256k1
|
||||
keys = make([]crypto.PrivKey, n, n)
|
||||
for i := 0; i < n; i++ {
|
||||
keys[i] = crypto.GenPrivKeyEd25519()
|
||||
keys[i] = ed25519.GenPrivKey()
|
||||
}
|
||||
|
||||
return
|
||||
|
@ -170,7 +171,7 @@ func GeneratePrivKeyAddressPairs(n int) (keys []crypto.PrivKey, addrs []sdk.AccA
|
|||
keys = make([]crypto.PrivKey, n, n)
|
||||
addrs = make([]sdk.AccAddress, n, n)
|
||||
for i := 0; i < n; i++ {
|
||||
keys[i] = crypto.GenPrivKeyEd25519()
|
||||
keys[i] = ed25519.GenPrivKey()
|
||||
addrs[i] = sdk.AccAddress(keys[i].PubKey().Address())
|
||||
}
|
||||
return
|
||||
|
|
|
@ -10,11 +10,11 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/stake"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
var (
|
||||
priv1 = crypto.GenPrivKeyEd25519()
|
||||
priv1 = ed25519.GenPrivKey()
|
||||
addr1 = sdk.AccAddress(priv1.PubKey().Address())
|
||||
coins = sdk.Coins{sdk.NewCoin("foocoin", 10)}
|
||||
)
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
|
@ -84,7 +85,7 @@ func newPubKey(pk string) (res crypto.PubKey) {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
var pkEd crypto.PubKeyEd25519
|
||||
var pkEd ed25519.PubKeyEd25519
|
||||
copy(pkEd[:], pkBytes[:])
|
||||
return pkEd
|
||||
}
|
||||
|
|
|
@ -9,16 +9,16 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
var (
|
||||
priv1 = crypto.GenPrivKeyEd25519()
|
||||
priv1 = ed25519.GenPrivKey()
|
||||
addr1 = sdk.AccAddress(priv1.PubKey().Address())
|
||||
priv2 = crypto.GenPrivKeyEd25519()
|
||||
priv2 = ed25519.GenPrivKey()
|
||||
addr2 = sdk.AccAddress(priv2.PubKey().Address())
|
||||
addr3 = sdk.AccAddress(crypto.GenPrivKeyEd25519().PubKey().Address())
|
||||
priv4 = crypto.GenPrivKeyEd25519()
|
||||
addr3 = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address())
|
||||
priv4 = ed25519.GenPrivKey()
|
||||
addr4 = sdk.AccAddress(priv4.PubKey().Address())
|
||||
coins = sdk.Coins{{"foocoin", sdk.NewInt(10)}}
|
||||
fee = auth.StdFee{
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
|
||||
|
@ -131,7 +132,7 @@ func NewPubKey(pk string) (res crypto.PubKey) {
|
|||
panic(err)
|
||||
}
|
||||
//res, err = crypto.PubKeyFromBytes(pkBytes)
|
||||
var pkEd crypto.PubKeyEd25519
|
||||
var pkEd ed25519.PubKeyEd25519
|
||||
copy(pkEd[:], pkBytes[:])
|
||||
return pkEd
|
||||
}
|
||||
|
|
|
@ -8,12 +8,13 @@ import (
|
|||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
"github.com/tendermint/tendermint/crypto/ed25519"
|
||||
)
|
||||
|
||||
var (
|
||||
pk1 = crypto.GenPrivKeyEd25519().PubKey()
|
||||
pk2 = crypto.GenPrivKeyEd25519().PubKey()
|
||||
pk3 = crypto.GenPrivKeyEd25519().PubKey()
|
||||
pk1 = ed25519.GenPrivKey().PubKey()
|
||||
pk2 = ed25519.GenPrivKey().PubKey()
|
||||
pk3 = ed25519.GenPrivKey().PubKey()
|
||||
addr1 = sdk.AccAddress(pk1.Address())
|
||||
addr2 = sdk.AccAddress(pk2.Address())
|
||||
addr3 = sdk.AccAddress(pk3.Address())
|
||||
|
|
Loading…
Reference in New Issue