-
Notifications
You must be signed in to change notification settings - Fork 685
test_blockchain_fixtures() works poorly #1562
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
Comments
For an example of how this can be useful, see #1181 (comment). In short: it shows exactly what differs between |
Here's a gist that demonstrates how I slap this together currently (via https://gist.github.com/veox/5874314b11cb731e69256c0bd451c88c (Note that some changes are part of cburgdorf#2.) |
This is awesome! I played with the gist and ended up with #1573 I think it makes sense to only run |
Another possibility for why we were using the global state tests is that we were running state tests before we even had code that was able to import blocks. ie~ EVM execution was being tested before chain structure, which makes sense to me from an ordering point of view. If that were true, then we only needed the global state tests for bootstrapping, so we could switch to the blockchain state tests. In general, I can't think of a reason why we can't use the ones inside blockchain tests right now. (Only that a block import failure would cause "false test failures" in state tests, which is a pretty minor problem I think) Mostly unrelated: I can't think of a reason that |
I think this can be closed as fixed by PR #1573. Respond if I'm missing something, will reopen. |
master
(commit b6865d0)pip freeze
): MISSING (sorry!..)What is wrong?
In testing for PR #1181 - which spawned PR #1560, and cburgdorf#2 in particular - I've done the following (quote from gitter):
The test function, however, works "poorly" in general, since it applies
verify_account_db()
unconditionally, and only after it has already applied the blocks (specified in the fixture) that have produced this account-DB-to-be-checked, and has compared the produced blocks (with those in the fixture).In other words:
Also, the
assert
inpy-evm/tests/json-fixtures/test_blockchain.py
Lines 123 to 125 in b6865d0
is never hit, because
apply_fixture_block_to_chain()
has a very similar nested validity check that gets hit in the same conditions - shadowing theassert
,and terrifying the poor sob debugging this with a single.cytoolz
-/functools
-obfuscated generic function (aren't these supposed to go on forever, all the way down?..)How can it be fixed
Not sure about the latter issue, and what "fixing" it might break. (Didn't do a
git blame
.)Regarding
verify_account_db()
: don't do this in a "works as expected" run, but fall back on it if the {block header,state root} check fails. This will become possible when the above is addressed, or if thechain
is grown without checks against the fixture.Perhaps then it would make sense to run all tests from
/BlockchainTests
and not/GeneralStateTests
... (Not sure.)The text was updated successfully, but these errors were encountered: