fix more tests

This commit is contained in:
Piper Merriam 2016-07-07 13:03:15 -06:00
parent 12c2e31d21
commit 0dfd86dce9
4 changed files with 12 additions and 5 deletions

View File

@ -1,7 +1,7 @@
pytest>=2.8.2
pytest-pythonpath>=0.3
tox>=1.8.0
eth-testrpc==0.3.2
eth-testrpc==0.4.0
py-geth>=0.5.0
# Until pyethereum > 1.3.6 is released.
https://github.com/ethereum/pyethereum/tarball/b06829e56e2a3de5276077a611ed8813b6cf5e74

View File

@ -12,6 +12,7 @@ from eth_tester_client.utils import (
coerce_args_to_bytes,
)
from web3.web3.rpcprovider import TestRPCProvider
from web3.utils.encoding import (
force_bytes,
encode_hex,
@ -51,6 +52,9 @@ def extract_ecdsa_signer(msg_hash, signature):
def test_eth_sign(web3):
if isinstance(web3.currentProvider, TestRPCProvider):
pytest.skip("testrpc doesn't implement `getBlockTransactionCount`")
private_key_hex = b'0x5e95384d8050109aab08c1922d3c230739bc16976553c317e5d0b87b59371f2a'
private_key = decode_hex(private_key_hex)
@ -95,9 +99,12 @@ def test_eth_sign(web3):
# Verify the signature against the public key derived from the
# original private key. It fails.
rec_id = signature_bytes[64]
if is_string(rec_id):
rec_id = ord(rec_id)
recoverable_signature = priv_key.ecdsa_recoverable_deserialize(
signature_bytes[:64],
signature_bytes[64],
rec_id,
)
signature = priv_key.ecdsa_recoverable_convert(recoverable_signature)
is_valid = priv_key.pubkey.ecdsa_verify(

View File

@ -31,11 +31,11 @@ def password_account(web3, account_password,
initial_balance = 1000000000000000000000 # 1,000 ether
funding_txn_hash = web3.eth.sendTransaction({
funding_txn_hash = web3.personal.signAndSendTransaction({
'from': web3.eth.coinbase,
'to': address,
'value': initial_balance,
})
}, account_password)
wait_for_transaction(funding_txn_hash)
assert web3.eth.getBalance(address) == initial_balance

View File

@ -93,7 +93,7 @@ class Web3(object):
def sha3(self, string, encoding=None):
if encoding is not None:
raise ValueError("encoding parameter currently not supported")
return self._requestManager.request_blocking('web3_sha3', [encode_hex(string)])
return self._requestManager.request_blocking('web3_sha3', [string])
def isConnected(self):
return self.currentProvider and self.currentProvider.isConnected()