Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate tester provider results from middleware to defaults #1188

Merged
merged 1 commit into from
Jan 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions web3/providers/eth_tester/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,20 @@ def personal_send_transaction(eth_tester, params):
),
},
'net': {
'version': not_implemented,
'peerCount': not_implemented,
'listening': not_implemented,
'version': static_return('1'),
'peerCount': static_return(0),
'listening': static_return(False),
},
'eth': {
'protocolVersion': not_implemented,
'syncing': not_implemented,
'protocolVersion': static_return('63'),
'syncing': static_return(False),
'coinbase': compose(
operator.itemgetter(0),
call_eth_tester('get_accounts'),
),
'mining': not_implemented,
'hashrate': not_implemented,
'gasPrice': not_implemented,
'mining': static_return(False),
'hashrate': static_return(0),
'gasPrice': static_return(1),
'accounts': call_eth_tester('get_accounts'),
'blockNumber': compose(
operator.itemgetter('number'),
Expand Down
2 changes: 0 additions & 2 deletions web3/providers/eth_tester/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

from .middleware import (
default_transaction_fields_middleware,
ethereum_tester_fixture_middleware,
ethereum_tester_middleware,
)


class EthereumTesterProvider(BaseProvider):
middlewares = [
default_transaction_fields_middleware,
ethereum_tester_fixture_middleware,
ethereum_tester_middleware,
]
ethereum_tester = None
Expand Down
15 changes: 0 additions & 15 deletions web3/providers/eth_tester/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
pipe,
)
from web3.middleware import (
construct_fixture_middleware,
construct_formatting_middleware,
)

Expand Down Expand Up @@ -259,20 +258,6 @@ def is_hexstr(value):
)


ethereum_tester_fixture_middleware = construct_fixture_middleware({
# Eth
'eth_protocolVersion': '63',
'eth_hashrate': 0,
'eth_gasPrice': 1,
'eth_syncing': False,
'eth_mining': False,
# Net
'net_version': '1',
'net_listening': False,
'net_peerCount': 0,
})


def guess_from(web3, transaction):
coinbase = web3.eth.coinbase
if coinbase is not None:
Expand Down