diff --git a/tests/core/json-rpc/test_ipc.py b/tests/core/json-rpc/test_ipc.py index 09a88dc8fe..4de8e42011 100644 --- a/tests/core/json-rpc/test_ipc.py +++ b/tests/core/json-rpc/test_ipc.py @@ -200,6 +200,37 @@ def uint256_to_bytes(uint): build_request('eth_hashrate'), {'result': '0x0', 'id': 3, 'jsonrpc': '2.0'}, ), + ( + build_request('eth_getWork'), + { + 'error': 'Method not implemented: \'eth_getWork\' Trinity does not support mining', + 'id': 3, + 'jsonrpc': '2.0' + }, + ), + ( + build_request('eth_submitWork', [ + "0x0000000000000001", + "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000" + ]), + { + 'error': 'Method not implemented: \'eth_submitWork\' Trinity does not support mining', # noqa: E501 + 'id': 3, + 'jsonrpc': '2.0' + }, + ), + ( + build_request('eth_submitHashrate', [ + "0x0000000000000000000000000000000000000000000000000000000000500000", + "0x59daa26581d0acd1fce254fb7e85952f4c09d0915afd33d3886cd914bc7d283c" + ]), + { + 'error': 'Method not implemented: \'eth_submitHashrate\' Trinity does not support mining', # noqa: E501 + 'id': 3, + 'jsonrpc': '2.0' + }, + ), ( build_request('web3_clientVersion'), {'result': construct_trinity_client_identifier(), 'id': 3, 'jsonrpc': '2.0'}, diff --git a/trinity/rpc/modules/eth.py b/trinity/rpc/modules/eth.py index 5508989634..5384169eb0 100644 --- a/trinity/rpc/modules/eth.py +++ b/trinity/rpc/modules/eth.py @@ -8,6 +8,7 @@ cast, Dict, List, + NoReturn, Union, ) from mypy_extensions import ( @@ -190,6 +191,17 @@ async def getBalance(self, address: Address, at_block: Union[str, int]) -> str: return hex(balance) + async def getWork(self) -> NoReturn: + raise NotImplementedError("Trinity does not support mining") + + @format_params(decode_hex, decode_hex, decode_hex) + async def submitWork(self, nonce: bytes, pow_hash: Hash32, mix_digest: Hash32) -> NoReturn: + raise NotImplementedError("Trinity does not support mining") + + @format_params(decode_hex, decode_hex) + async def submitHashrate(self, hashrate: Hash32, id: Hash32) -> NoReturn: + raise NotImplementedError("Trinity does not support mining") + @format_params(decode_hex, identity) async def getBlockByHash(self, block_hash: Hash32,