We don't have any integration tests for parity.
It's very difficult to test code like #366
Generate some data in a parity fixture database (similar to how the geth one works) and build the integration conftest file.
We also need some way to install a specific version of parity which should likely be done with a small shell script to start off with until we can iterate towards a generic solution.
Great point. For determining which versions to test against, I could see which versions are used in the nodes on https://ethstats.net/
Any other ideas? How did you decide for geth?
For determining which versions to test against
I would suggest only the latest point releases excluding any with known bugs, starting with whatever the current latest is.
How did you decide for geth?
Whatever was newest at the time.
@dylanjw here's the parity integration test issue.
Here's an example integration "setup" file: https://github.com/ethereum/web3.py/blob/master/tests/integration/test_goethereum.py
It ultimately calls all these tests against the fixtures for geth: https://github.com/ethereum/web3.py/tree/master/web3/utils/module_testing
For example: https://github.com/ethereum/web3.py/blob/master/web3/utils/module_testing/eth_module.py
So one way to set up the parity integration tests would be to:
funded_account_for_raw_txn fixture that returns the hex address of the account that's funded.tox.ini with the parity setup.travis.yml for each parity version to testI didn't set up the geth integration tests, so it's totally possible that I'm missing some things in this high-level approach, but the above steps should be a good place to start.
See here for documentation on the necessary fixtures for the intergration tests: https://github.com/ethereum/web3.py/blob/master/tests/integration/README.md
I have created fixtures for parity. Because parity does not have mining functionality, I used the following method to in the generation script:
A big challenge was creating matching genesis files. Parity requires that you configure the starting block number for various EIPs. Some of these are configurable in the geth genesis file and others are not.
The majority of the tests that depend on the fixtures are currently failing. Tomorrow I will dig into the tests themselves and do some clean up of the fixture generation scripts.
The majority of the tests that depend on the fixtures are currently failing.
Feel free to post a list of the failing tests, along with the ones you think make sense to focus on, and others that make sense to punt.
Because parity does not have mining functionality
Note, Parity does not have a _mining_ functionality for Ethash, but it provides other engines of sealing blogs for AuRa, Tendermint, "Instant Seal" (Dev mode).
If a PoW environment causes you headache, you can just switch the engine.
Thanks @5chdn, I'll take a look at the other engines.
@carver Running tests on my system (Im still working on the travis CI config), I get 10 failed, 87 passed.
Here is a summary of the failing tests:
TestParityEthModule.test_eth_newBlockFilterTestParityEthModule.test_eth_uninstallFilterTestParityPersonalModule.test_personal_importRawKeyTestParityPersonalModule.test_personal_listAccountsTestParityPersonalModule.test_personal_lockAccountTestParityPersonalModule.test_personal_unlockAccount_successTestParityPersonalModule.test_personal_unlockAccount_failureTestParityPersonalModule.test_personal_newAccountTestParityPersonalModule.test_personal_sendTransactionTestParityPersonalModule.test_personal_sign_and_ecrecoverIm going to start with looking into 1 & 2. For the failures due to missing methods, I will probably drop all of these. I will also look at adding a parity module and tests.
Im going to start with looking into 1 & 2. For the failures due to missing methods, I will probably drop all of these.
Sounds totally reasonable. Looking pretty close!
One approach to dropping the personal_* tests would be:
class TestParityPersonalModule...
def test_personal_listAccounts(self):
pytest.xfail('this non-standard json-rpc method is not implemented on parity')`
Plus, adding a xfail_strict=true line to the pytest.ini (which has been on my todo list).
Then we get notified if any of them start working.
I will add TestParityEthModule.test_eth_uninstallFilter to the xfail tests. Parity returns true for any filter id parameter I enter, so I raised this issue: https://github.com/paritytech/parity/issues/7783
For the test_eth_newBlockFilter failure, on the first poll parity returns the latest block hash, instead of none. Subsequent polls return the expected empty list
def test_eth_newBlockFilter(self, web3):
filter = web3.eth.filter('latest')
assert is_string(filter.filter_id)
changes = web3.eth.getFilterChanges(filter.filter_id)
assert is_list_like(changes)
> assert not changes
E AssertionError
changes = [HexBytes('0xa449e487af78da9478c2e8e3a435a4d4a08fa5d8891d79c80abc3f1c3f6c1b93')]
(Pdb) web3.eth.getFilterChanges(filter.filter_id)
[]
I marked test_eth_newBlockFilter as xfail as well.
Parity returns true for any filter id parameter I enter, so I raised this issue: paritytech/parity#7783
Awesome :+1:
on the first poll parity returns the latest block hash, instead of none
Interesting find. Did you file an issue for that as well?
Interesting find. Did you file an issue for that as well?
I did not. Will do.
Most helpful comment
@carver Running tests on my system (Im still working on the travis CI config), I get 10 failed, 87 passed.
Here is a summary of the failing tests:
TestParityEthModule.test_eth_newBlockFilterAssertionError on line 438
TestParityEthModule.test_eth_uninstallFilterAssertionError on line 544
TestParityPersonalModule.test_personal_importRawKeyMethodNotFound: personal_importRawKey
TestParityPersonalModule.test_personal_listAccountsMethodNotFound: personal_listAccounts
TestParityPersonalModule.test_personal_lockAccountMethodNotFound: personal_lockAccount
TestParityPersonalModule.test_personal_unlockAccount_successMethodNotFound: personal_unlockAccount
TestParityPersonalModule.test_personal_unlockAccount_failureMethodNotFound: personal_unlockAccount
TestParityPersonalModule.test_personal_newAccountMethodNotFound: personal_newAccount
TestParityPersonalModule.test_personal_sendTransactionMethodNotFound: personal_sendTransaction
TestParityPersonalModule.test_personal_sign_and_ecrecoverMethodNotFound: personal_sign
Im going to start with looking into 1 & 2. For the failures due to missing methods, I will probably drop all of these. I will also look at adding a
paritymodule and tests.