Skip to content

Commit a0e4974

Browse files
committed
Remove audit warning on w3.eth.account
1 parent 838b51d commit a0e4974

4 files changed

Lines changed: 8 additions & 68 deletions

File tree

conftest.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,7 @@ def _wait_for_transaction(web3, txn_hash, timeout=120):
100100
@pytest.fixture()
101101
def web3():
102102
provider = EthereumTesterProvider()
103-
w3 = Web3(provider)
104-
105-
# Delete this whole block after eth-account has passed security audit
106-
try:
107-
w3.eth.account
108-
except AttributeError:
109-
pass
110-
else:
111-
raise AssertionError("Unaudited features must be disabled by default")
112-
w3.eth.enable_unaudited_features()
113-
114-
return w3
103+
return Web3(provider)
115104

116105

117106
@pytest.fixture(autouse=True)

docs/web3.eth.account.rst

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,6 @@
11
Working with Local Private Keys
22
==========================================
33

4-
Not Acceptable for Production
5-
---------------------------------
6-
7-
.. WARNING::
8-
**Do not use** this module in production. It is still in beta. A security audit is pending.
9-
10-
Now is a great time to get familiar with the API, and test out writing
11-
code that uses some of the great upcoming features.
12-
13-
By default, access to this module has been turned off in the stable version of Web3.py:
14-
15-
.. code-block:: python
16-
17-
>>> from web3.auto import w3
18-
>>> w3.eth.account
19-
...
20-
AttributeError: This feature is disabled, pending security audit. ...
21-
22-
In order to access these features, you can either:
23-
24-
1. Turn it on inside web3 with:
25-
26-
.. code-block:: python
27-
28-
>>> from web3.auto import w3
29-
>>> w3.eth.enable_unaudited_features()
30-
>>> w3.eth.account
31-
32-
2. Load the beta version of :class:`eth_account.Account <eth_account.account.Account>`
33-
directly, with:
34-
35-
.. code-block:: python
36-
37-
>>> from eth_account import Account
38-
>>> account = Account()
39-
40-
.. testsetup::
41-
42-
from web3.auto import w3
43-
w3.eth.enable_unaudited_features()
44-
454
Local vs Hosted Nodes
465
---------------------------------
476

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
install_requires=[
2020
"cytoolz>=0.9.0,<1.0.0",
2121
"eth-abi>=1.0.0,<2",
22-
"eth-account==0.2.0-alpha.0",
22+
"eth-account>=0.2.1,<0.3.0",
2323
"eth-utils>=1.0.1,<2.0.0",
2424
"hexbytes>=0.1.0,<1.0.0",
2525
"lru-dict>=1.1.6,<2.0.0",

web3/eth.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
from web3.utils.blocks import (
2727
select_method_for_block_identifier,
2828
)
29+
from web3.utils.decorators import (
30+
deprecated_for,
31+
)
2932
from web3.utils.empty import (
3033
empty,
3134
)
@@ -48,27 +51,16 @@
4851

4952

5053
class Eth(Module):
51-
_account = None
54+
account = Account()
5255
defaultAccount = empty
5356
defaultBlock = "latest"
5457
defaultContractFactory = Contract
5558
iban = Iban
5659
gasPriceStrategy = None
5760

58-
@property
59-
def account(self):
60-
if self._account is not None:
61-
return self._account
62-
else:
63-
raise AttributeError(
64-
"This feature is disabled, pending security audit. "
65-
"If you want to use unaudited code dealing with private keys, "
66-
"despite the risks, you can run `w3.eth.enable_unaudited_features()` "
67-
"and try again."
68-
)
69-
61+
@deprecated_for("doing nothing at all")
7062
def enable_unaudited_features(self):
71-
self._account = Account()
63+
pass
7264

7365
def namereg(self):
7466
raise NotImplementedError()

0 commit comments

Comments
 (0)