ethereum / eth-tester

Tool suite for testing ethereum applications.
MIT License
364 stars 146 forks source link

Transaction not mined when running multiple unit tests (PyEthereum21Backend) #101

Open artemistomaras opened 6 years ago

artemistomaras commented 6 years ago

Suppose the following django project structure:

Also suppose the following TestCase setup for both test files:

    def setUp(self):
        # Retrieve a fresh client copy
        self.client = MyClient(
            provider=self.provider, ...
        )

        super().setUp()

    def tearDown(self):
        # Revert to the clean state for every test case
        self.eth_tester.revert_to_snapshot(self.clean_state_snapshot)
        super().tearDown()

    @classmethod
    def setUpTestData(cls):
        """Only once setup"""
        cls.eth_tester = EthereumTester(backend=PyEthereum21Backend())
        cls.provider = EthereumTesterProvider(cls.eth_tester)
        cls.web3 = Web3(cls.provider)

        # deploying smart contracts etc ...

        cls.clean_state_snapshot = cls.eth_tester.take_snapshot()

Below is the output of running each TestCase on its own:

# client.tests output
Failed to import bitcoin. This is not a fatal error but does
mean that you will not be able to determine the address from
your wallet file.
Using existing test database for alias 'default'...
System check identified no issues (0 silenced).
Initializing chain from provided state
Initializing chain from provided state
INFO:eth.block  Block pre-sealed, 21000 gas used 
INFO:eth.chain  Adding to head head=c6745cf3
Saved 3 address change logs
INFO:eth.chain  Added block 1 (5f5f608a) with 1 txs and 21000 gas 
INFO:eth.block  Block pre-sealed, 470791 gas used 
INFO:eth.chain  Adding to head head=5f5f608a
Saved 2 address change logs
INFO:eth.chain  Added block 2 (3c04531f) with 1 txs and 470791 gas 
INFO:eth.block  Block pre-sealed, 1641161 gas used 
INFO:eth.chain  Adding to head head=3c04531f
Saved 2 address change logs
INFO:eth.chain  Added block 3 (94a8e4d5) with 1 txs and 1641161 gas 
INFO:eth.block  Block pre-sealed, 505467 gas used 
INFO:eth.chain  Adding to head head=94a8e4d5
Saved 2 address change logs
INFO:eth.chain  Added block 4 (92e1a399) with 1 txs and 505467 gas 
INFO:eth.block  Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
INFO:eth.block  Block pre-sealed, 98148 gas used 
INFO:eth.chain  Adding to head head=08aa138d
Saved 7 address change logs
INFO:eth.chain  Added block 6 (c1174bae) with 1 txs and 98148 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
INFO:eth.block  Block pre-sealed, 98148 gas used 
INFO:eth.chain  Adding to head head=08aa138d
Saved 7 address change logs
INFO:eth.chain  Added block 6 (c1174bae) with 1 txs and 98148 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
INFO:eth.block  Block pre-sealed, 98020 gas used 
INFO:eth.chain  Adding to head head=08aa138d
Saved 7 address change logs
INFO:eth.chain  Added block 6 (d4d6425a) with 1 txs and 98020 gas 
.
----------------------------------------------------------------------
Ran 6 tests in 1.762s

OK
Preserving test database for alias 'default'..

and for the api tests:

Failed to import bitcoin. This is not a fatal error but does
mean that you will not be able to determine the address from
your wallet file.
Using existing test database for alias 'default'...
System check identified no issues (0 silenced).
Initializing chain from provided state
Initializing chain from provided state
INFO:eth.block  Block pre-sealed, 21000 gas used 
INFO:eth.chain  Adding to head head=c6745cf3
Saved 3 address change logs
INFO:eth.chain  Added block 1 (5f5f608a) with 1 txs and 21000 gas 
INFO:eth.block  Block pre-sealed, 470791 gas used 
INFO:eth.chain  Adding to head head=5f5f608a
Saved 2 address change logs
INFO:eth.chain  Added block 2 (3c04531f) with 1 txs and 470791 gas 
INFO:eth.block  Block pre-sealed, 1641161 gas used 
INFO:eth.chain  Adding to head head=3c04531f
Saved 2 address change logs
INFO:eth.chain  Added block 3 (94a8e4d5) with 1 txs and 1641161 gas 
INFO:eth.block  Block pre-sealed, 505467 gas used 
INFO:eth.chain  Adding to head head=94a8e4d5
Saved 2 address change logs
INFO:eth.chain  Added block 4 (92e1a399) with 1 txs and 505467 gas 
INFO:eth.block  Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
INFO:eth.block  Block pre-sealed, 98148 gas used 
INFO:eth.chain  Adding to head head=08aa138d
Saved 7 address change logs
INFO:eth.chain  Added block 6 (2d599c9a) with 1 txs and 98148 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
INFO:eth.block  Block pre-sealed, 98148 gas used 
INFO:eth.chain  Adding to head head=08aa138d
Saved 7 address change logs
INFO:eth.chain  Added block 6 (2d599c9a) with 1 txs and 98148 gas 
.
----------------------------------------------------------------------
Ran 6 tests in 1.652s

OK
Preserving test database for alias 'default'...

Everything looks ok. The problem appears when I try to run both test cases at once, using a single python3 manage.py test command.

What will happen is that inside my code, a call to web3.eth.waitForTransactionReceipt will always timeout or, a call to EthereumTester.get_transaction_receipt will always raise a TransactionNotFound

Below is the output of executing both test cases together, and me pressing ctrl+c to terminate when the call to web3.eth.waitForTransactionReceipt blocks ( setting the timeout to 1 second for example will just make all my unit tests fail )

Failed to import bitcoin. This is not a fatal error but does
mean that you will not be able to determine the address from
your wallet file.
Using existing test database for alias 'default'...
System check identified no issues (0 silenced).
Initializing chain from provided state
Initializing chain from provided state
INFO:eth.block  Block pre-sealed, 21000 gas used 
INFO:eth.chain  Adding to head head=c6745cf3
Saved 3 address change logs
INFO:eth.chain  Added block 1 (5f5f608a) with 1 txs and 21000 gas 
INFO:eth.block  Block pre-sealed, 470791 gas used 
INFO:eth.chain  Adding to head head=5f5f608a
Saved 2 address change logs
INFO:eth.chain  Added block 2 (3c04531f) with 1 txs and 470791 gas 
INFO:eth.block  Block pre-sealed, 1641161 gas used 
INFO:eth.chain  Adding to head head=3c04531f
Saved 2 address change logs
INFO:eth.chain  Added block 3 (94a8e4d5) with 1 txs and 1641161 gas 
INFO:eth.block  Block pre-sealed, 505467 gas used 
INFO:eth.chain  Adding to head head=94a8e4d5
Saved 2 address change logs
INFO:eth.chain  Added block 4 (92e1a399) with 1 txs and 505467 gas 
INFO:eth.block  Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
INFO:eth.block  Block pre-sealed, 98148 gas used 
INFO:eth.chain  Adding to head head=08aa138d
Saved 7 address change logs
INFO:eth.chain  Added block 6 (0fa9f473) with 1 txs and 98148 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
.INFO:eth.block Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
INFO:eth.block  Block pre-sealed, 98148 gas used 
INFO:eth.chain  Adding to head head=08aa138d
Saved 7 address change logs
INFO:eth.chain  Added block 6 (0fa9f473) with 1 txs and 98148 gas 
.Initializing chain from provided state
Initializing chain from provided state
INFO:eth.block  Block pre-sealed, 21000 gas used 
INFO:eth.chain  Adding to head head=c6745cf3
Saved 3 address change logs
INFO:eth.chain  Added block 1 (5f5f608a) with 1 txs and 21000 gas 
INFO:eth.block  Block pre-sealed, 470791 gas used 
INFO:eth.chain  Adding to head head=5f5f608a
Saved 2 address change logs
INFO:eth.chain  Added block 2 (3c04531f) with 1 txs and 470791 gas 
INFO:eth.block  Block pre-sealed, 1641161 gas used 
INFO:eth.chain  Adding to head head=3c04531f
Saved 2 address change logs
INFO:eth.chain  Added block 3 (94a8e4d5) with 1 txs and 1641161 gas 
INFO:eth.block  Block pre-sealed, 505467 gas used 
INFO:eth.chain  Adding to head head=94a8e4d5
Saved 2 address change logs
INFO:eth.chain  Added block 4 (92e1a399) with 1 txs and 505467 gas 
INFO:eth.block  Block pre-sealed, 283526 gas used 
INFO:eth.chain  Adding to head head=92e1a399
Saved 4 address change logs
INFO:eth.chain  Added block 5 (08aa138d) with 1 txs and 283526 gas 
^C^CTraceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/django/core/management/commands/test.py", line 26, in run_from_argv
    super().run_from_argv(argv)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/django/core/management/commands/test.py", line 59, in handle
    failures = test_runner.run_tests(test_labels)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/django/test/runner.py", line 603, in run_tests
    result = self.run_suite(suite)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/django/test/runner.py", line 569, in run_suite
    return runner.run(suite)
  File "/usr/lib/python3.6/unittest/runner.py", line 176, in run
    test(result)
  File "/usr/lib/python3.6/unittest/suite.py", line 84, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python3.6/unittest/suite.py", line 122, in run
    test(result)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/django/test/testcases.py", line 206, in __call__
    super().__call__(result)
  File "/usr/lib/python3.6/unittest/case.py", line 653, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python3.6/unittest/case.py", line 605, in run
    testMethod()
  File "/home/artemis/PycharmProjects/uport_relay_server/client/tests/test_client.py", line 110, in test_create_identity
    log = self._create_identity(owner, owner)
  File "/home/artemis/PycharmProjects/uport_relay_server/client/tests/test_client.py", line 91, in _create_identity
    tx_receipt = self.web3.eth.waitForTransactionReceipt(tx_hash)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/eth.py", line 199, in waitForTransactionReceipt
    return wait_for_transaction_receipt(self.web3, transaction_hash, timeout)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/utils/transactions.py", line 54, in wait_for_transaction_receipt
    txn_receipt = web3.eth.getTransactionReceipt(txn_hash)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/eth.py", line 204, in getTransactionReceipt
    [transaction_hash],
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/manager.py", line 103, in request_blocking
    response = self._make_request(method, params)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/manager.py", line 86, in _make_request
    return request_func(method, params)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/middleware/gas_price_strategy.py", line 18, in middleware
    return make_request(method, params)
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/middleware/formatting.py", line 48, in apply_formatters
    response = make_request(method, formatted_params)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/middleware/attrdict.py", line 18, in middleware
    response = make_request(method, params)
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/middleware/formatting.py", line 50, in apply_formatters
    response = make_request(method, params)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/middleware/normalize_errors.py", line 9, in middleware
    result = make_request(method, params)
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/middleware/formatting.py", line 50, in apply_formatters
    response = make_request(method, params)
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/middleware/formatting.py", line 48, in apply_formatters
    response = make_request(method, formatted_params)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/providers/eth_tester/middleware.py", line 322, in middleware
    return make_request(method, params)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/middleware/fixture.py", line 12, in middleware
    return make_request(method, params)
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/middleware/formatting.py", line 50, in apply_formatters
    response = make_request(method, params)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/providers/eth_tester/main.py", line 46, in make_request
    response = delegator(self.ethereum_tester, params)
  File "cytoolz/functoolz.pyx", line 758, in cytoolz.functoolz.excepts.__call__
  File "cytoolz/functoolz.pyx", line 491, in cytoolz.functoolz.Compose.__call__
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/web3/providers/eth_tester/defaults.py", line 36, in call_eth_tester
    return getattr(eth_tester, fn_name)(*fn_args, **fn_kwargs)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/eth_tester/main.py", line 336, in get_transaction_receipt
    raw_receipt = self.backend.get_transaction_receipt(raw_transaction_hash)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/eth_tester/backends/pyethereum/v20/main.py", line 376, in get_transaction_receipt
    transaction_hash,
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/eth_tester/backends/pyethereum/v20/main.py", line 155, in _get_transaction_by_hash
    if transaction.hash == transaction_hash:
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/ethereum/transactions.py", line 141, in hash
    return utils.sha3(rlp.encode(self))
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/ethereum/utils.py", line 192, in sha3
    return sha3_256(to_string(seed))
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/ethereum/utils.py", line 4, in sha3_256
    def sha3_256(x): return keccak.new(digest_bits=256, data=x).digest()
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/Crypto/Hash/keccak.py", line 173, in new
    return Keccak_Hash(data, digest_bytes, update_after_digest)
  File "/home/artemis/.virtualenvs/uport_relay_server/lib/python3.6/site-packages/Crypto/Hash/keccak.py", line 70, in __init__
    state = VoidPointer()
  File "/usr/lib/python3.6/unittest/signals.py", line 36, in __call__
    self.default_handler(signum, frame)
KeyboardInterrupt
dylanjw commented 6 years ago

Are you by any chance sharing the setUpTestData method between your two test cases through inheritance?

artemistomaras commented 6 years ago

@dylanjw no. My two test cases reside in different files with a setUpTestData in each one.

artemistomaras commented 6 years ago

After more fiddling around I found the following:

  1. Running the tests in reverse order (with -r flag) I still get the same issue
  2. Running the tests in parallel (with --parallel flag), my test get executed without an issue
(uport_relay_server) artemis@artemis-pc:~/PycharmProjects/uport_relay_server$ python3 manage.py test --parallel --settings=uport_relay_server.settings.test

Failed to import bitcoin. This is not a fatal error but does
mean that you will not be able to determine the address from
your wallet file.
Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
System check identified no issues (0 silenced).
Initializing chain from provided state
Initializing chain from provided state
Initializing chain from provided state
Initializing chain from provided state
INFO:eth.block  Block pre-sealed, 21000 gas used
INFO:eth.block  Block pre-sealed, 21000 gas used
INFO:eth.chain  Adding to head head=c6745cf3
INFO:eth.chain  Adding to head head=c6745cf3
Saved 3 address change logs
Saved 3 address change logs
INFO:eth.chain  Added block 1 (211e11df) with 1 txs and 21000 gas
INFO:eth.chain  Added block 1 (211e11df) with 1 txs and 21000 gas
INFO:eth.block  Block pre-sealed, 470791 gas used
INFO:eth.block  Block pre-sealed, 470791 gas used
INFO:eth.chain  Adding to head head=211e11df
INFO:eth.chain  Adding to head head=211e11df
Saved 2 address change logs
INFO:eth.chain  Added block 2 (404f8090) with 1 txs and 470791 gas
Saved 2 address change logs
INFO:eth.chain  Added block 2 (404f8090) with 1 txs and 470791 gas
INFO:eth.block  Block pre-sealed, 1641161 gas used
INFO:eth.block  Block pre-sealed, 1641161 gas used
INFO:eth.chain  Adding to head head=404f8090
INFO:eth.chain  Adding to head head=404f8090
Saved 2 address change logs
INFO:eth.chain  Added block 3 (c5ab0a92) with 1 txs and 1641161 gas
Saved 2 address change logs
INFO:eth.chain  Added block 3 (c5ab0a92) with 1 txs and 1641161 gas
INFO:eth.block  Block pre-sealed, 505467 gas used
INFO:eth.block  Block pre-sealed, 505467 gas used
INFO:eth.chain  Adding to head head=c5ab0a92
INFO:eth.chain  Adding to head head=c5ab0a92
Saved 2 address change logs
INFO:eth.chain  Added block 4 (4c0ccfe2) with 1 txs and 505467 gas
Saved 2 address change logs
INFO:eth.chain  Added block 4 (4c0ccfe2) with 1 txs and 505467 gas
INFO:eth.block  Block pre-sealed, 283526 gas used
INFO:eth.chain  Adding to head head=4c0ccfe2
INFO:eth.block  Block pre-sealed, 283526 gas used
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.chain  Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block  Block pre-sealed, 283526 gas used
INFO:eth.chain  Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block  Block pre-sealed, 283526 gas used
INFO:eth.chain  Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block  Block pre-sealed, 283526 gas used
INFO:eth.chain  Adding to head head=4c0ccfe2
INFO:eth.block  Block pre-sealed, 283526 gas used
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.chain  Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block  Block pre-sealed, 98148 gas used
INFO:eth.chain  Adding to head head=51fb8023
INFO:eth.block  Block pre-sealed, 283526 gas used
INFO:eth.chain  Adding to head head=4c0ccfe2
Saved 7 address change logs
INFO:eth.chain  Added block 6 (288e4f20) with 1 txs and 98148 gas
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block  Block pre-sealed, 283526 gas used
INFO:eth.chain  Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block  Block pre-sealed, 98148 gas used
INFO:eth.chain  Adding to head head=51fb8023
Saved 7 address change logs
INFO:eth.chain  Added block 6 (288e4f20) with 1 txs and 98148 gas
INFO:eth.block  Block pre-sealed, 283526 gas used
INFO:eth.chain  Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block  Block pre-sealed, 283526 gas used
INFO:eth.chain  Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block  Block pre-sealed, 283526 gas used
INFO:eth.chain  Adding to head head=4c0ccfe2
INFO:eth.block  Block pre-sealed, 98148 gas used
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.chain  Adding to head head=51fb8023
Saved 7 address change logs
INFO:eth.chain  Added block 6 (288e4f20) with 1 txs and 98148 gas
INFO:eth.block  Block pre-sealed, 283526 gas used
INFO:eth.chain  Adding to head head=4c0ccfe2
Saved 4 address change logs
INFO:eth.chain  Added block 5 (51fb8023) with 1 txs and 283526 gas
INFO:eth.block  Block pre-sealed, 98148 gas used
INFO:eth.chain  Adding to head head=51fb8023
Saved 7 address change logs
INFO:eth.chain  Added block 6 (288e4f20) with 1 txs and 98148 gas
......INFO:eth.block    Block pre-sealed, 98148 gas used
INFO:eth.chain  Adding to head head=51fb8023
Saved 7 address change logs
INFO:eth.chain  Added block 6 (288e4f20) with 1 txs and 98148 gas
......
----------------------------------------------------------------------
Ran 12 tests in 2.353s

OK
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
dylanjw commented 6 years ago

@artemistomaras Do you get the same issue using the PyEVMBackend instead of the PyEthereum21Backend? The fact that running with the --parallel works seems to indicate something is getting screwed up by running the two test cases in the same process. Can you set a break point before the failure, and poke around to see if the chain state is what you would expect at that point in the test? Do any transactions submitted at the break point remain unmined, or is it just the one that is getting lost?