chore(crypto): update btcec to v2 (#13513)
Similar to Tendermint's PR, https://github.com/tendermint/tendermint/pull/9250 Note that crypto/ledger is not updated in this PR, because if its dependency on the R and S values being exposed by ParseDERSignature. Updates #13423 Signed-off-by: Elias Naur <elias@orijtech.com> Signed-off-by: Elias Naur <elias@orijtech.com> Co-authored-by: Marko <marbar3778@yahoo.com>
This commit is contained in:
parent
a34d5b213d
commit
ed9cd41396
|
@ -10,7 +10,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewParams creates a BIP 44 parameter object from the params:
|
// NewParams creates a BIP 44 parameter object from the params:
|
||||||
|
@ -225,7 +225,7 @@ func derivePrivateKey(privKeyBytes [32]byte, chainCode [32]byte, index uint32, h
|
||||||
data = append([]byte{byte(0)}, privKeyBytes[:]...)
|
data = append([]byte{byte(0)}, privKeyBytes[:]...)
|
||||||
} else {
|
} else {
|
||||||
// this can't return an error:
|
// this can't return an error:
|
||||||
_, ecPub := btcec.PrivKeyFromBytes(btcec.S256(), privKeyBytes[:])
|
_, ecPub := btcec.PrivKeyFromBytes(privKeyBytes[:])
|
||||||
pubkeyBytes := ecPub.SerializeCompressed()
|
pubkeyBytes := ecPub.SerializeCompressed()
|
||||||
data = pubkeyBytes
|
data = pubkeyBytes
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
secp256k1 "github.com/btcsuite/btcd/btcec"
|
secp256k1 "github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/tendermint/tendermint/crypto"
|
"github.com/tendermint/tendermint/crypto"
|
||||||
"golang.org/x/crypto/ripemd160" //nolint: staticcheck
|
"golang.org/x/crypto/ripemd160" //nolint: staticcheck
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ func (privKey *PrivKey) Bytes() []byte {
|
||||||
// PubKey performs the point-scalar multiplication from the privKey on the
|
// PubKey performs the point-scalar multiplication from the privKey on the
|
||||||
// generator point to get the pubkey.
|
// generator point to get the pubkey.
|
||||||
func (privKey *PrivKey) PubKey() cryptotypes.PubKey {
|
func (privKey *PrivKey) PubKey() cryptotypes.PubKey {
|
||||||
_, pubkeyObject := secp256k1.PrivKeyFromBytes(secp256k1.S256(), privKey.Key)
|
_, pubkeyObject := secp256k1.PrivKeyFromBytes(privKey.Key)
|
||||||
pk := pubkeyObject.SerializeCompressed()
|
pk := pubkeyObject.SerializeCompressed()
|
||||||
return &PubKey{Key: pk}
|
return &PubKey{Key: pk}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
btcSecp256k1 "github.com/btcsuite/btcd/btcec"
|
btcSecp256k1 "github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,29 +4,22 @@
|
||||||
package secp256k1
|
package secp256k1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/big"
|
secp256k1 "github.com/btcsuite/btcd/btcec/v2"
|
||||||
|
"github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||||
secp256k1 "github.com/btcsuite/btcd/btcec"
|
|
||||||
|
|
||||||
"github.com/tendermint/tendermint/crypto"
|
"github.com/tendermint/tendermint/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// used to reject malleable signatures
|
|
||||||
// see:
|
|
||||||
// - https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/signature_nocgo.go#L90-L93
|
|
||||||
// - https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/crypto.go#L39
|
|
||||||
var secp256k1halfN = new(big.Int).Rsh(secp256k1.S256().N, 1)
|
|
||||||
|
|
||||||
// Sign creates an ECDSA signature on curve Secp256k1, using SHA256 on the msg.
|
// Sign creates an ECDSA signature on curve Secp256k1, using SHA256 on the msg.
|
||||||
// The returned signature will be of the form R || S (in lower-S form).
|
// The returned signature will be of the form R || S (in lower-S form).
|
||||||
func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) {
|
func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) {
|
||||||
priv, _ := secp256k1.PrivKeyFromBytes(secp256k1.S256(), privKey.Key)
|
priv, _ := secp256k1.PrivKeyFromBytes(privKey.Key)
|
||||||
sig, err := priv.Sign(crypto.Sha256(msg))
|
sig, err := ecdsa.SignCompact(priv, crypto.Sha256(msg), false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
sigBytes := serializeSig(sig)
|
// remove the first byte which is compactSigRecoveryCode
|
||||||
return sigBytes, nil
|
return sig[1:], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyBytes verifies a signature of the form R || S.
|
// VerifyBytes verifies a signature of the form R || S.
|
||||||
|
@ -35,7 +28,7 @@ func (pubKey *PubKey) VerifySignature(msg []byte, sigStr []byte) bool {
|
||||||
if len(sigStr) != 64 {
|
if len(sigStr) != 64 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
pub, err := secp256k1.ParsePubKey(pubKey.Key, secp256k1.S256())
|
pub, err := secp256k1.ParsePubKey(pubKey.Key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -43,7 +36,13 @@ func (pubKey *PubKey) VerifySignature(msg []byte, sigStr []byte) bool {
|
||||||
signature := signatureFromBytes(sigStr)
|
signature := signatureFromBytes(sigStr)
|
||||||
// Reject malleable signatures. libsecp256k1 does this check but btcec doesn't.
|
// Reject malleable signatures. libsecp256k1 does this check but btcec doesn't.
|
||||||
// see: https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/signature_nocgo.go#L90-L93
|
// see: https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/signature_nocgo.go#L90-L93
|
||||||
if signature.S.Cmp(secp256k1halfN) > 0 {
|
// Serialize() would negate S value if it is over half order.
|
||||||
|
// Hence, if the signature is different after Serialize() if should be rejected.
|
||||||
|
modifiedSignature, parseErr := ecdsa.ParseDERSignature(signature.Serialize())
|
||||||
|
if parseErr != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if !signature.IsEqual(modifiedSignature) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return signature.Verify(crypto.Sha256(msg), pub)
|
return signature.Verify(crypto.Sha256(msg), pub)
|
||||||
|
@ -51,21 +50,10 @@ func (pubKey *PubKey) VerifySignature(msg []byte, sigStr []byte) bool {
|
||||||
|
|
||||||
// Read Signature struct from R || S. Caller needs to ensure
|
// Read Signature struct from R || S. Caller needs to ensure
|
||||||
// that len(sigStr) == 64.
|
// that len(sigStr) == 64.
|
||||||
func signatureFromBytes(sigStr []byte) *secp256k1.Signature {
|
func signatureFromBytes(sigStr []byte) *ecdsa.Signature {
|
||||||
return &secp256k1.Signature{
|
var r secp256k1.ModNScalar
|
||||||
R: new(big.Int).SetBytes(sigStr[:32]),
|
r.SetByteSlice(sigStr[:32])
|
||||||
S: new(big.Int).SetBytes(sigStr[32:64]),
|
var s secp256k1.ModNScalar
|
||||||
}
|
s.SetByteSlice(sigStr[32:64])
|
||||||
}
|
return ecdsa.NewSignature(&r, &s)
|
||||||
|
|
||||||
// Serialize signature to R || S.
|
|
||||||
// R, S are padded to 32 bytes respectively.
|
|
||||||
func serializeSig(sig *secp256k1.Signature) []byte {
|
|
||||||
rBytes := sig.R.Bytes()
|
|
||||||
sBytes := sig.S.Bytes()
|
|
||||||
sigBytes := make([]byte, 64)
|
|
||||||
// 0 pad the byte arrays from the left if they aren't big enough.
|
|
||||||
copy(sigBytes[32-len(rBytes):32], rBytes)
|
|
||||||
copy(sigBytes[64-len(sBytes):64], sBytes)
|
|
||||||
return sigBytes
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ package secp256k1
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
secp256k1 "github.com/btcsuite/btcd/btcec"
|
secp256k1 "github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,20 +19,29 @@ func TestSignatureVerificationAndRejectUpperS(t *testing.T) {
|
||||||
priv := GenPrivKey()
|
priv := GenPrivKey()
|
||||||
sigStr, err := priv.Sign(msg)
|
sigStr, err := priv.Sign(msg)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
sig := signatureFromBytes(sigStr)
|
var r secp256k1.ModNScalar
|
||||||
require.False(t, sig.S.Cmp(secp256k1halfN) > 0)
|
r.SetByteSlice(sigStr[:32])
|
||||||
|
var s secp256k1.ModNScalar
|
||||||
|
s.SetByteSlice(sigStr[32:64])
|
||||||
|
require.False(t, s.IsOverHalfOrder())
|
||||||
|
|
||||||
pub := priv.PubKey()
|
pub := priv.PubKey()
|
||||||
require.True(t, pub.VerifySignature(msg, sigStr))
|
require.True(t, pub.VerifySignature(msg, sigStr))
|
||||||
|
|
||||||
// malleate:
|
// malleate:
|
||||||
sig.S.Sub(secp256k1.S256().CurveParams.N, sig.S)
|
var S256 secp256k1.ModNScalar
|
||||||
require.True(t, sig.S.Cmp(secp256k1halfN) > 0)
|
S256.SetByteSlice(secp256k1.S256().N.Bytes())
|
||||||
malSigStr := serializeSig(sig)
|
s.Negate().Add(&S256)
|
||||||
|
require.True(t, s.IsOverHalfOrder())
|
||||||
|
|
||||||
|
rBytes := r.Bytes()
|
||||||
|
sBytes := s.Bytes()
|
||||||
|
malSigStr := make([]byte, 64)
|
||||||
|
copy(malSigStr[32-len(rBytes):32], rBytes[:])
|
||||||
|
copy(malSigStr[64-len(sBytes):64], sBytes[:])
|
||||||
require.False(t, pub.VerifySignature(msg, malSigStr),
|
require.False(t, pub.VerifySignature(msg, malSigStr),
|
||||||
"VerifyBytes incorrect with malleated & invalid S. sig=%v, key=%v",
|
"VerifyBytes incorrect with malleated & invalid S. sig=%v, key=%v",
|
||||||
sig,
|
malSigStr,
|
||||||
priv,
|
priv,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
btcSecp256k1 "github.com/btcsuite/btcd/btcec"
|
btcSecp256k1 "github.com/btcsuite/btcd/btcec/v2"
|
||||||
|
btcecdsa "github.com/btcsuite/btcd/btcec/v2/ecdsa"
|
||||||
"github.com/cosmos/btcutil/base58"
|
"github.com/cosmos/btcutil/base58"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
@ -64,7 +65,7 @@ func TestSignAndValidateSecp256k1(t *testing.T) {
|
||||||
// ----
|
// ----
|
||||||
// Test cross packages verification
|
// Test cross packages verification
|
||||||
msgHash := crypto.Sha256(msg)
|
msgHash := crypto.Sha256(msg)
|
||||||
btcPrivKey, btcPubKey := btcSecp256k1.PrivKeyFromBytes(btcSecp256k1.S256(), privKey.Key)
|
btcPrivKey, btcPubKey := btcSecp256k1.PrivKeyFromBytes(privKey.Key)
|
||||||
// This fails: malformed signature: no header magic
|
// This fails: malformed signature: no header magic
|
||||||
// btcSig, err := secp256k1.ParseSignature(sig, secp256k1.S256())
|
// btcSig, err := secp256k1.ParseSignature(sig, secp256k1.S256())
|
||||||
// require.NoError(t, err)
|
// require.NoError(t, err)
|
||||||
|
@ -77,9 +78,11 @@ func TestSignAndValidateSecp256k1(t *testing.T) {
|
||||||
ok := ecdsa.Verify(btcPubKey.ToECDSA(), msgHash, r, s)
|
ok := ecdsa.Verify(btcPubKey.ToECDSA(), msgHash, r, s)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
|
|
||||||
sig2, err := btcPrivKey.Sign(msgHash)
|
sig2, err := btcecdsa.SignCompact(btcPrivKey, msgHash, false)
|
||||||
|
// Chop off compactSigRecoveryCode.
|
||||||
|
sig2 = sig2[1:]
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
pubKey.VerifySignature(msg, sig2.Serialize())
|
pubKey.VerifySignature(msg, sig2)
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
// Mutate the signature, just one bit.
|
// Mutate the signature, just one bit.
|
||||||
|
@ -98,7 +101,7 @@ func TestSecp256k1LoadPrivkeyAndSerializeIsIdentity(t *testing.T) {
|
||||||
|
|
||||||
// This function creates a private and public key in the underlying libraries format.
|
// This function creates a private and public key in the underlying libraries format.
|
||||||
// The private key is basically calling new(big.Int).SetBytes(pk), which removes leading zero bytes
|
// The private key is basically calling new(big.Int).SetBytes(pk), which removes leading zero bytes
|
||||||
priv, _ := btcSecp256k1.PrivKeyFromBytes(btcSecp256k1.S256(), privKeyBytes[:])
|
priv, _ := btcSecp256k1.PrivKeyFromBytes(privKeyBytes[:])
|
||||||
// this takes the bytes returned by `(big int).Bytes()`, and if the length is less than 32 bytes,
|
// this takes the bytes returned by `(big int).Bytes()`, and if the length is less than 32 bytes,
|
||||||
// pads the bytes from the left with zero bytes. Therefore these two functions composed
|
// pads the bytes from the left with zero bytes. Therefore these two functions composed
|
||||||
// result in the identity function on privKeyBytes, hence the following equality check
|
// result in the identity function on privKeyBytes, hence the following equality check
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -12,6 +12,7 @@ require (
|
||||||
github.com/armon/go-metrics v0.4.1
|
github.com/armon/go-metrics v0.4.1
|
||||||
github.com/bgentry/speakeasy v0.1.0
|
github.com/bgentry/speakeasy v0.1.0
|
||||||
github.com/btcsuite/btcd v0.22.2
|
github.com/btcsuite/btcd v0.22.2
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.2.1
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
|
||||||
github.com/cockroachdb/apd/v2 v2.0.2
|
github.com/cockroachdb/apd/v2 v2.0.2
|
||||||
github.com/coinbase/rosetta-sdk-go v0.8.1
|
github.com/coinbase/rosetta-sdk-go v0.8.1
|
||||||
|
@ -81,6 +82,7 @@ require (
|
||||||
github.com/creachadair/taskgroup v0.3.2 // indirect
|
github.com/creachadair/taskgroup v0.3.2 // indirect
|
||||||
github.com/danieljoos/wincred v1.1.2 // indirect
|
github.com/danieljoos/wincred v1.1.2 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
||||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
|
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
|
||||||
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
|
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
|
||||||
github.com/dgraph-io/ristretto v0.1.0 // indirect
|
github.com/dgraph-io/ristretto v0.1.0 // indirect
|
||||||
|
|
6
go.sum
6
go.sum
|
@ -124,6 +124,8 @@ github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BR
|
||||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||||
github.com/btcsuite/btcd v0.22.2 h1:vBZ+lGGd1XubpOWO67ITJpAEsICWhA0YzqkcpkgNBfo=
|
github.com/btcsuite/btcd v0.22.2 h1:vBZ+lGGd1XubpOWO67ITJpAEsICWhA0YzqkcpkgNBfo=
|
||||||
github.com/btcsuite/btcd v0.22.2/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y=
|
github.com/btcsuite/btcd v0.22.2/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y=
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.2.1 h1:xP60mv8fvp+0khmrN0zTdPC3cNm24rfeE6lh2R/Yv3E=
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.2.1/go.mod h1:9/CSmJxmuvqzX9Wh2fXMWToLOHhPd11lSPuIupwTkI8=
|
||||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||||
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||||
|
@ -220,6 +222,10 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
|
||||||
|
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
|
||||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
|
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
|
||||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
|
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
|
||||||
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
|
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"cosmossdk.io/math"
|
"cosmossdk.io/math"
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
rosettatypes "github.com/coinbase/rosetta-sdk-go/types"
|
rosettatypes "github.com/coinbase/rosetta-sdk-go/types"
|
||||||
abci "github.com/tendermint/tendermint/abci/types"
|
abci "github.com/tendermint/tendermint/abci/types"
|
||||||
"github.com/tendermint/tendermint/crypto"
|
"github.com/tendermint/tendermint/crypto"
|
||||||
|
@ -649,7 +649,7 @@ func (c converter) PubKey(pubKey *rosettatypes.PublicKey) (cryptotypes.PubKey, e
|
||||||
return nil, crgerrs.WrapError(crgerrs.ErrUnsupportedCurve, "only secp256k1 supported")
|
return nil, crgerrs.WrapError(crgerrs.ErrUnsupportedCurve, "only secp256k1 supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp, err := btcec.ParsePubKey(pubKey.Bytes, btcec.S256())
|
cmp, err := btcec.ParsePubKey(pubKey.Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, crgerrs.WrapError(crgerrs.ErrBadArgument, err.Error())
|
return nil, crgerrs.WrapError(crgerrs.ErrBadArgument, err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ require (
|
||||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
|
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
|
||||||
github.com/bgentry/speakeasy v0.1.0 // indirect
|
github.com/bgentry/speakeasy v0.1.0 // indirect
|
||||||
github.com/btcsuite/btcd v0.22.2 // indirect
|
github.com/btcsuite/btcd v0.22.2 // indirect
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
|
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
|
||||||
github.com/cespare/xxhash v1.1.0 // indirect
|
github.com/cespare/xxhash v1.1.0 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||||
|
@ -52,6 +53,7 @@ require (
|
||||||
github.com/creachadair/taskgroup v0.3.2 // indirect
|
github.com/creachadair/taskgroup v0.3.2 // indirect
|
||||||
github.com/danieljoos/wincred v1.1.2 // indirect
|
github.com/danieljoos/wincred v1.1.2 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
||||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
|
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
|
||||||
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
|
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
|
||||||
github.com/dgraph-io/ristretto v0.1.0 // indirect
|
github.com/dgraph-io/ristretto v0.1.0 // indirect
|
||||||
|
|
|
@ -124,6 +124,8 @@ github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BR
|
||||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||||
github.com/btcsuite/btcd v0.22.2 h1:vBZ+lGGd1XubpOWO67ITJpAEsICWhA0YzqkcpkgNBfo=
|
github.com/btcsuite/btcd v0.22.2 h1:vBZ+lGGd1XubpOWO67ITJpAEsICWhA0YzqkcpkgNBfo=
|
||||||
github.com/btcsuite/btcd v0.22.2/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y=
|
github.com/btcsuite/btcd v0.22.2/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y=
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.2.1 h1:xP60mv8fvp+0khmrN0zTdPC3cNm24rfeE6lh2R/Yv3E=
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.2.1/go.mod h1:9/CSmJxmuvqzX9Wh2fXMWToLOHhPd11lSPuIupwTkI8=
|
||||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||||
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||||
|
@ -216,6 +218,10 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
|
||||||
|
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
|
||||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
|
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
|
||||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
|
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
|
||||||
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
|
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
|
||||||
|
|
|
@ -35,6 +35,7 @@ require (
|
||||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
|
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
|
||||||
github.com/bgentry/speakeasy v0.1.0 // indirect
|
github.com/bgentry/speakeasy v0.1.0 // indirect
|
||||||
github.com/btcsuite/btcd v0.22.2 // indirect
|
github.com/btcsuite/btcd v0.22.2 // indirect
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.2.1 // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
|
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
|
||||||
github.com/cespare/xxhash v1.1.0 // indirect
|
github.com/cespare/xxhash v1.1.0 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||||
|
@ -52,6 +53,7 @@ require (
|
||||||
github.com/creachadair/taskgroup v0.3.2 // indirect
|
github.com/creachadair/taskgroup v0.3.2 // indirect
|
||||||
github.com/danieljoos/wincred v1.1.2 // indirect
|
github.com/danieljoos/wincred v1.1.2 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
||||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
|
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
|
||||||
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
|
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
|
||||||
github.com/dgraph-io/ristretto v0.1.0 // indirect
|
github.com/dgraph-io/ristretto v0.1.0 // indirect
|
||||||
|
|
|
@ -124,6 +124,8 @@ github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BR
|
||||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||||
github.com/btcsuite/btcd v0.22.2 h1:vBZ+lGGd1XubpOWO67ITJpAEsICWhA0YzqkcpkgNBfo=
|
github.com/btcsuite/btcd v0.22.2 h1:vBZ+lGGd1XubpOWO67ITJpAEsICWhA0YzqkcpkgNBfo=
|
||||||
github.com/btcsuite/btcd v0.22.2/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y=
|
github.com/btcsuite/btcd v0.22.2/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y=
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.2.1 h1:xP60mv8fvp+0khmrN0zTdPC3cNm24rfeE6lh2R/Yv3E=
|
||||||
|
github.com/btcsuite/btcd/btcec/v2 v2.2.1/go.mod h1:9/CSmJxmuvqzX9Wh2fXMWToLOHhPd11lSPuIupwTkI8=
|
||||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||||
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||||
|
@ -216,6 +218,10 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
|
||||||
|
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
|
||||||
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
|
||||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
|
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
|
||||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
|
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
|
||||||
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
|
github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o=
|
||||||
|
|
Loading…
Reference in New Issue