Skip to content

Commit

Permalink
Clean up rpc endpoints according to updated spec
Browse files Browse the repository at this point in the history
  • Loading branch information
njgheorghita committed Mar 11, 2019
1 parent 652650d commit 8bcd127
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 65 deletions.
15 changes: 0 additions & 15 deletions docs/web3.net.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,6 @@ Properties

The following properties are available on the ``web3.net`` namespace.

.. py:method:: Net.chainId(self)
This method is trivially implemented.
It will always return `None`, which is a valid chainId to specify in the transaction.

If you want the real chainId of your node, you must manually determine it for now.

Note that your transactions (may be) replayable on forks of the network you intend, if
:ref:`eth-account` and using a chainId of `None`.

.. code-block:: python
>>> web3.net.chainId
None
.. py:method:: Net.version(self)
* Delegates to ``net_version`` RPC Method
Expand Down
26 changes: 0 additions & 26 deletions web3/_utils/module_testing/eth_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,16 +531,6 @@ def test_eth_getTransactionByHash_contract_creation(self,
assert is_dict(transaction)
assert transaction['to'] is None, "to field is %r" % transaction['to']

def test_eth_getTransactionFromBlockHashAndIndex(self, web3, block_with_txn, mined_txn_hash):
transaction = web3.eth.getTransactionFromBlock(block_with_txn['hash'], 0)
assert is_dict(transaction)
assert transaction['hash'] == HexBytes(mined_txn_hash)

def test_eth_getTransactionFromBlockNumberAndIndex(self, web3, block_with_txn, mined_txn_hash):
transaction = web3.eth.getTransactionFromBlock(block_with_txn['number'], 0)
assert is_dict(transaction)
assert transaction['hash'] == HexBytes(mined_txn_hash)

def test_eth_getTransactionByBlockHashAndIndex(self, web3, block_with_txn, mined_txn_hash):
transaction = web3.eth.getTransactionByBlock(block_with_txn['hash'], 0)
assert is_dict(transaction)
Expand Down Expand Up @@ -600,22 +590,6 @@ def test_eth_getUncleByBlockNumberAndIndex(self, web3):
# TODO: how do we make uncles....
pass

def test_eth_getCompilers(self, web3):
# TODO: do we want to test this?
pass

def test_eth_compileSolidity(self, web3):
# TODO: do we want to test this?
pass

def test_eth_compileLLL(self, web3):
# TODO: do we want to test this?
pass

def test_eth_compileSerpent(self, web3):
# TODO: do we want to test this?
pass

def test_eth_newFilter(self, web3):
filter = web3.eth.filter({})

Expand Down
2 changes: 1 addition & 1 deletion web3/_utils/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'data': b'',
'gas': lambda web3, tx: web3.eth.estimateGas(tx),
'gasPrice': lambda web3, tx: web3.eth.generateGasPrice(tx) or web3.eth.gasPrice,
'chainId': lambda web3, tx: web3.net.chainId,
'chainId': lambda web3, tx: web3.net.version,
}


Expand Down
18 changes: 0 additions & 18 deletions web3/eth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
from web3._utils.blocks import (
select_method_for_block_identifier,
)
from web3._utils.decorators import (
deprecated_for,
)
from web3._utils.empty import (
empty,
)
Expand Down Expand Up @@ -66,10 +63,6 @@ class Eth(Module):
iban = Iban
gasPriceStrategy = None

@deprecated_for("doing nothing at all")
def enable_unaudited_features(self):
pass

def namereg(self):
raise NotImplementedError()

Expand Down Expand Up @@ -220,14 +213,6 @@ def getTransaction(self, transaction_hash):
raise TransactionNotFound(f"Transaction with hash: {transaction_hash} not found.")
return result

@deprecated_for("w3.eth.getTransactionByBlock")
def getTransactionFromBlock(self, block_identifier, transaction_index):
"""
Alias for the method getTransactionByBlock
Depreceated to maintain naming consistency with the json-rpc API
"""
return self.getTransactionByBlock(block_identifier, transaction_index)

def getTransactionByBlock(self, block_identifier, transaction_index):
"""
`eth_getTransactionByBlockHashAndIndex`
Expand Down Expand Up @@ -418,9 +403,6 @@ def contract(self,
def setContractFactory(self, contractFactory):
self.defaultContractFactory = contractFactory

def getCompilers(self):
return self.web3.manager.request_blocking("eth_getCompilers", [])

def getWork(self):
return self.web3.manager.request_blocking("eth_getWork", [])

Expand Down
2 changes: 1 addition & 1 deletion web3/middleware/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

@curry
def validate_chain_id(web3, chain_id):
if chain_id == web3.net.chainId:
if chain_id == web3.net.version:
return chain_id
else:
raise ValidationError(
Expand Down
4 changes: 0 additions & 4 deletions web3/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ def listening(self):
def peerCount(self):
return self.web3.manager.request_blocking("net_peerCount", [])

@property
def chainId(self):
return None

@property
def version(self):
return self.web3.manager.request_blocking("net_version", [])

0 comments on commit 8bcd127

Please sign in to comment.