Skip to content

Commit

Permalink
Implement stubs for eth_getWork, eth_submitWork and eth_submitHashrate
Browse files Browse the repository at this point in the history
  • Loading branch information
cburgdorf committed Jan 14, 2020
1 parent c38877b commit 51ccfac
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/core/json-rpc/test_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down
12 changes: 12 additions & 0 deletions trinity/rpc/modules/eth.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
cast,
Dict,
List,
NoReturn,
Union,
)
from mypy_extensions import (
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 51ccfac

Please # to comment.