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

Eliminate signTransaction warning #1404

Merged
merged 1 commit into from
Aug 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions tests/core/eth-module/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_eth_account_privateKeyToAccount_seed_restrictions(acct):
def test_eth_account_privateKeyToAccount_properties(acct, PRIVATE_BYTES):
account = acct.privateKeyToAccount(PRIVATE_BYTES)
assert callable(account.signHash)
assert callable(account.signTransaction)
assert callable(account.sign_transaction)
assert is_checksum_address(account.address)
assert account.address == '0xa79F6f349C853F9Ea0B29636779ae3Cb4E3BA729'
assert account.privateKey == PRIVATE_BYTES
Expand All @@ -132,7 +132,7 @@ def test_eth_account_privateKeyToAccount_properties(acct, PRIVATE_BYTES):
def test_eth_account_create_properties(acct):
account = acct.create()
assert callable(account.signHash)
assert callable(account.signTransaction)
assert callable(account.sign_transaction)
assert is_checksum_address(account.address)
assert isinstance(account.privateKey, bytes) and len(account.privateKey) == 32

Expand Down Expand Up @@ -283,15 +283,15 @@ def test_eth_account_sign(acct, message, key, expected_bytes, expected_hash, v,
ids=['web3js_example', '31byte_r_and_s'],
)
def test_eth_account_sign_transaction(acct, txn, private_key, expected_raw_tx, tx_hash, r, s, v):
signed = acct.signTransaction(txn, private_key)
signed = acct.sign_transaction(txn, private_key)
assert signed.r == r
assert signed.s == s
assert signed.v == v
assert signed.rawTransaction == expected_raw_tx
assert signed.hash == tx_hash

account = acct.privateKeyToAccount(private_key)
assert account.signTransaction(txn) == signed
assert account.sign_transaction(txn) == signed


@pytest.mark.parametrize(
Expand All @@ -309,7 +309,7 @@ def test_eth_account_sign_transaction_from_eth_test(acct, transaction_info):
# generated from the transaction hash and private key, mostly due to code
# author's ignorance. The example test fixtures and implementations seem to agree, so far.
# See ecdsa_raw_sign() in /eth_keys/backends/native/ecdsa.py
signed = acct.signTransaction(transaction, key)
signed = acct.sign_transaction(transaction, key)
assert signed.r == Web3.toInt(hexstr=expected_raw_txn[-130:-66])

# confirm that signed transaction can be recovered to the sender
Expand Down
2 changes: 1 addition & 1 deletion web3/middleware/signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def middleware(method, params):
return make_request(method, params)

account = accounts[transaction['from']]
raw_tx = account.signTransaction(transaction).rawTransaction
raw_tx = account.sign_transaction(transaction).rawTransaction

return make_request(
"eth_sendRawTransaction",
Expand Down