From a0e4974cc90c93d8d20508672a8c4e4a100ccfaf Mon Sep 17 00:00:00 2001 From: Jason Carver Date: Mon, 23 Apr 2018 15:58:14 -0700 Subject: [PATCH] Remove audit warning on w3.eth.account --- conftest.py | 13 +------------ docs/web3.eth.account.rst | 41 --------------------------------------- setup.py | 2 +- web3/eth.py | 20 ++++++------------- 4 files changed, 8 insertions(+), 68 deletions(-) diff --git a/conftest.py b/conftest.py index e1726567e6..d4459ef7e2 100644 --- a/conftest.py +++ b/conftest.py @@ -100,18 +100,7 @@ def _wait_for_transaction(web3, txn_hash, timeout=120): @pytest.fixture() def web3(): provider = EthereumTesterProvider() - w3 = Web3(provider) - - # Delete this whole block after eth-account has passed security audit - try: - w3.eth.account - except AttributeError: - pass - else: - raise AssertionError("Unaudited features must be disabled by default") - w3.eth.enable_unaudited_features() - - return w3 + return Web3(provider) @pytest.fixture(autouse=True) diff --git a/docs/web3.eth.account.rst b/docs/web3.eth.account.rst index 728ccc1318..697a154e28 100644 --- a/docs/web3.eth.account.rst +++ b/docs/web3.eth.account.rst @@ -1,47 +1,6 @@ Working with Local Private Keys ========================================== -Not Acceptable for Production ---------------------------------- - -.. WARNING:: - **Do not use** this module in production. It is still in beta. A security audit is pending. - -Now is a great time to get familiar with the API, and test out writing -code that uses some of the great upcoming features. - -By default, access to this module has been turned off in the stable version of Web3.py: - -.. code-block:: python - - >>> from web3.auto import w3 - >>> w3.eth.account - ... - AttributeError: This feature is disabled, pending security audit. ... - -In order to access these features, you can either: - -1. Turn it on inside web3 with: - - .. code-block:: python - - >>> from web3.auto import w3 - >>> w3.eth.enable_unaudited_features() - >>> w3.eth.account - -2. Load the beta version of :class:`eth_account.Account ` - directly, with: - - .. code-block:: python - - >>> from eth_account import Account - >>> account = Account() - -.. testsetup:: - - from web3.auto import w3 - w3.eth.enable_unaudited_features() - Local vs Hosted Nodes --------------------------------- diff --git a/setup.py b/setup.py index 1b732fcb7d..a048e4b95b 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ install_requires=[ "cytoolz>=0.9.0,<1.0.0", "eth-abi>=1.0.0,<2", - "eth-account==0.2.0-alpha.0", + "eth-account>=0.2.1,<0.3.0", "eth-utils>=1.0.1,<2.0.0", "hexbytes>=0.1.0,<1.0.0", "lru-dict>=1.1.6,<2.0.0", diff --git a/web3/eth.py b/web3/eth.py index 90a01baeed..409cf788ca 100644 --- a/web3/eth.py +++ b/web3/eth.py @@ -26,6 +26,9 @@ from web3.utils.blocks import ( select_method_for_block_identifier, ) +from web3.utils.decorators import ( + deprecated_for, +) from web3.utils.empty import ( empty, ) @@ -48,27 +51,16 @@ class Eth(Module): - _account = None + account = Account() defaultAccount = empty defaultBlock = "latest" defaultContractFactory = Contract iban = Iban gasPriceStrategy = None - @property - def account(self): - if self._account is not None: - return self._account - else: - raise AttributeError( - "This feature is disabled, pending security audit. " - "If you want to use unaudited code dealing with private keys, " - "despite the risks, you can run `w3.eth.enable_unaudited_features()` " - "and try again." - ) - + @deprecated_for("doing nothing at all") def enable_unaudited_features(self): - self._account = Account() + pass def namereg(self): raise NotImplementedError()