Skip to content

Commit a39aa9b

Browse files
authored
Fix eth-account docs and core tests (#3404)
* Require eth-account 0.13.x to get doctests passing * Fix eth-account doctests * Move signHash -> unsafe_sign_hash * Add newsfragment
1 parent 5df77f9 commit a39aa9b

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

docs/web3.eth.account.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ is provided by :meth:`w3.eth.sign() <web3.eth.Eth.sign>`.
218218
>>> message = encode_defunct(text=msg)
219219
>>> signed_message = w3.eth.account.sign_message(message, private_key=private_key)
220220
>>> signed_message
221-
SignedMessage(messageHash=HexBytes('0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750'),
222-
message_hash=HexBytes('0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750'),
221+
SignedMessage(message_hash=HexBytes('0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750'),
223222
r=104389933075820307925104709181714897380569894203213074526835978196648170704563,
224223
s=28205917190874851400050446352651915501321657673772411533993420917949420456142,
225224
v=28,

newsfragments/3404.internal.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove uses of signHash in tests, require eth-account >=0.13.0 in doctests

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
"sphinx-autobuild>=2021.3.14",
2626
"sphinx_rtd_theme>=1.0.0",
2727
"towncrier>=21,<22",
28+
# web3 will work but emit warnings with eth-account>=0.12.2,
29+
# but doctests fail between 0.12.2 and 0.13.0
30+
"eth-account>=0.13.0",
2831
],
2932
"test": [
3033
"eth-tester[py-evm]>=0.11.0b1,<0.13.0b1",

tests/core/eth-module/test_accounts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_eth_account_from_key_seed_restrictions(acct):
132132

133133
def test_eth_account_from_key_properties(acct, PRIVATE_BYTES):
134134
account = acct.from_key(PRIVATE_BYTES)
135-
assert callable(account.signHash)
135+
assert callable(account.unsafe_sign_hash)
136136
assert callable(account.sign_transaction)
137137
assert is_checksum_address(account.address)
138138
assert account.address == "0xa79F6f349C853F9Ea0B29636779ae3Cb4E3BA729"
@@ -141,7 +141,7 @@ def test_eth_account_from_key_properties(acct, PRIVATE_BYTES):
141141

142142
def test_eth_account_create_properties(acct):
143143
account = acct.create()
144-
assert callable(account.signHash)
144+
assert callable(account.unsafe_sign_hash)
145145
assert callable(account.sign_transaction)
146146
assert is_checksum_address(account.address)
147147
assert isinstance(account.key, bytes) and len(account.key) == 32

0 commit comments

Comments
 (0)