Skip to content

Commit

Permalink
Try enabling the geth miner for replaceTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes committed Jan 15, 2020
1 parent 6e16d4b commit 2c90120
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/integration/go_ethereum/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
Web3ModuleTest,
)

OLDER_GETH_VERSIONS = ['v1.7.2', 'v1.8.22']
NEWER_GETH_VERSIONS = ['v1.8.22', 'v1.9.7']
GETH_VERSIONS_WITHOUT_MINING_CONTROL = ['v1.7.2', 'v1.8.22']
GETH_VERSIONS_WITHOUT_ETH_SUBMITHASH = ['v1.8.22', 'v1.9.7']


class GoEthereumTest(Web3ModuleTest):
Expand All @@ -21,19 +21,19 @@ def _check_web3_clientVersion(self, client_version):

class GoEthereumEthModuleTest(EthModuleTest):
def test_eth_replaceTransaction(self, web3, unlocked_account):
if any([v in web3.clientVersion for v in OLDER_GETH_VERSIONS]):
pytest.xfail(reason='Needs ability to efficiently control mining')
# if any([v in web3.clientVersion for v in GETH_VERSIONS_WITHOUT_MINING_CONTROL]):
# pytest.xfail(reason='Needs ability to efficiently control mining')
super().test_eth_replaceTransaction(web3, unlocked_account)

def test_eth_replaceTransaction_gas_price_defaulting_minimum(self, web3, unlocked_account):
if any([v in web3.clientVersion for v in OLDER_GETH_VERSIONS]):
if any([v in web3.clientVersion for v in GETH_VERSIONS_WITHOUT_MINING_CONTROL]):
pytest.xfail(reason='Needs ability to efficiently control mining')
super().test_eth_replaceTransaction_gas_price_defaulting_minimum(web3, unlocked_account)

def test_eth_replaceTransaction_gas_price_defaulting_strategy_higher(self,
web3,
unlocked_account):
if any([v in web3.clientVersion for v in OLDER_GETH_VERSIONS]):
if any([v in web3.clientVersion for v in GETH_VERSIONS_WITHOUT_MINING_CONTROL]):
pytest.xfail(reason='Needs ability to efficiently control mining')
super().test_eth_replaceTransaction_gas_price_defaulting_strategy_higher(
web3, unlocked_account
Expand All @@ -42,14 +42,14 @@ def test_eth_replaceTransaction_gas_price_defaulting_strategy_higher(self,
def test_eth_replaceTransaction_gas_price_defaulting_strategy_lower(self,
web3,
unlocked_account):
if any([v in web3.clientVersion for v in OLDER_GETH_VERSIONS]):
if any([v in web3.clientVersion for v in GETH_VERSIONS_WITHOUT_MINING_CONTROL]):
pytest.xfail(reason='Needs ability to efficiently control mining')
super().test_eth_replaceTransaction_gas_price_defaulting_strategy_lower(
web3, unlocked_account
)

def test_eth_modifyTransaction(self, web3, unlocked_account):
if any([v in web3.clientVersion for v in OLDER_GETH_VERSIONS]):
if any([v in web3.clientVersion for v in GETH_VERSIONS_WITHOUT_MINING_CONTROL]):
pytest.xfail(reason='Needs ability to efficiently control mining')
super().test_eth_modifyTransaction(web3, unlocked_account)

Expand All @@ -62,7 +62,7 @@ def test_eth_estimateGas_with_block(self,
)

def test_eth_submitHashrate(self, web3):
if any([v in web3.clientVersion for v in NEWER_GETH_VERSIONS]):
if any([v in web3.clientVersion for v in GETH_VERSIONS_WITHOUT_ETH_SUBMITHASH]):
# https://github.com/ethereum/go-ethereum/commit/51db5975cc5fb88db6a0dba1826b534fd4df29d7
pytest.xfail('eth_submitHashrate deprecated in 1.8.22 for ethash_submitHashRate')
super().test_eth_submitHashrate(web3)
Expand Down
3 changes: 3 additions & 0 deletions web3/_utils/module_testing/eth_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,11 @@ def test_eth_replaceTransaction(
txn_hash = web3.eth.sendTransaction(txn_params)

txn_params['gasPrice'] = Wei(web3.eth.gasPrice * 2)
web3.geth.miner.start()
replace_txn_hash = web3.eth.replaceTransaction(txn_hash, txn_params)
web3.eth.waitForTransactionReceipt(replace_txn_hash)
replace_txn = web3.eth.getTransaction(replace_txn_hash)
web3.geth.miner.stop()

assert is_same_address(replace_txn['from'], cast(ChecksumAddress, txn_params['from']))
assert is_same_address(replace_txn['to'], cast(ChecksumAddress, txn_params['to']))
Expand Down

0 comments on commit 2c90120

Please sign in to comment.