Skip to content

Commit

Permalink
Merge pull request #9 from MysteriumNetwork/go-ethereum-update
Browse files Browse the repository at this point in the history
Updated go-ethereum to 1.8.14
  • Loading branch information
tadovas authored Aug 24, 2018
2 parents 6fd859d + 9f59d28 commit 0aaddad
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 27 deletions.
109 changes: 93 additions & 16 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

[[constraint]]
name = "github.com/ethereum/go-ethereum"
version = "1.8.8"
version = "=1.8.14"

[[constraint]]
name = "github.com/stretchr/testify"
Expand Down
5 changes: 4 additions & 1 deletion identity/keystore_signer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func TestKeyStoreSignerProvidesValidSignature(t *testing.T) {
pubKeyBytes, err := crypto.Ecrecover(crypto.Keccak256(signData), extractedSignature)
assert.NoError(t, err)

recoveredIdentity := crypto.PubkeyToAddress(*crypto.ToECDSAPub(pubKeyBytes))
key, err := crypto.UnmarshalPubkey(pubKeyBytes)
assert.NoError(t, err)

recoveredIdentity := crypto.PubkeyToAddress(*key)

assert.Equal(t, acc.Address, recoveredIdentity)

Expand Down
5 changes: 4 additions & 1 deletion promises/promise.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ func SignByReceiver(promise *IssuedPromise, receiver identity.Signer) (*Received
if err != nil {
return nil, err
}
pubKey := crypto.ToECDSAPub(publicKey)
pubKey, err := crypto.UnmarshalPubkey(publicKey)
if err != nil {
return nil, err
}
payerAddr := crypto.PubkeyToAddress(*pubKey)
sig, err := receiver.Sign([]byte(receiverPrefix), crypto.Keccak256(promise.Bytes()), payerAddr.Bytes())
return &ReceivedPromise{
Expand Down
3 changes: 2 additions & 1 deletion registry/keystore_identity_holder.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ func (ki *keystoreIdentityHolder) GetPublicKey() (ecdsa.PublicKey, error) {
if err != nil {
return ecdsa.PublicKey{}, err
}
return *crypto.ToECDSAPub(pubKeyBytes), nil
key, err := crypto.UnmarshalPubkey(pubKeyBytes)
return *key, err
}

func FromKeystore(keystore *keystore.KeyStore, address common.Address) IdentityHolder {
Expand Down
7 changes: 1 addition & 6 deletions registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package registry

import (
"crypto/ecdsa"
"errors"
"math/big"

"github.com/MysteriumNetwork/payments/registry/generated"
Expand Down Expand Up @@ -53,9 +52,5 @@ func (registry *Registry) LookupPublicKey(address common.Address) (*ecdsa.Public

prefix := []byte{4}
fullKey := append(prefix, append(part1[:], part2[:]...)...)
pubKey := crypto.ToECDSAPub(fullKey)
if pubKey == nil {
return nil, errors.New("unable to deserialize public key")
}
return pubKey, nil
return crypto.UnmarshalPubkey(fullKey)
}
2 changes: 1 addition & 1 deletion test_utils/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type TransactionalBackend interface {
func NewSimulatedBackend(genesisAddress common.Address, initialAmmount int64) TransactionalBackend {
sb := backends.NewSimulatedBackend(core.GenesisAlloc{
genesisAddress: {Balance: big.NewInt(initialAmmount)},
})
}, 10000000)
return sb
}

Expand Down

0 comments on commit 0aaddad

Please sign in to comment.