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

Update upstream fixtures to v7.0.0 beta.1 + fix consensus failures #1858

Closed

Conversation

veox
Copy link
Contributor

@veox veox commented Oct 9, 2019

Squashed/rebased version moved to PR #1871.


What was wrong?

Upstream tests have released a new tagged version, v7.0.0-beta.1, which py-evm needs to support.

How was it fixed?

A lot of plumbing was fixed in PR #1852 by @voith: see his commits (first nine) and discussion in that PR.

I based this branch on that PR, fixing the remaining 2 cases of consensus failures. They're described in commit messages; in short, py-evm now walks the entire computation tree.

Closes #1852 as superseded.

Closes #1857 as fixed.

Extra: Istanbul block numbers are set for mainnet and Goerli. Ropsten already had it set.

To-Do

  • Clean up commit history (as much as I could; squashing further will obfuscate logic)

Cute Animal Picture

put a cute animal picture link inside the parentheses

Source: Valdemaras.N

@veox veox changed the title Update fixtures to v7.0.0 beta.1 rebased Update upstream fixtures to v7.0.0 beta.1 + fix consensus failures Oct 9, 2019
@veox veox force-pushed the update-fixtures-to-v7.0.0-beta.1-rebased branch from 7923369 to 3cd92a1 Compare October 9, 2019 14:16
@veox
Copy link
Contributor Author

veox commented Oct 9, 2019

Github is displaying the commits in the wrong order after a rebase/force-push.

% git log --pretty=oneline --abbrev-commit
84b5bb78 misc: add "newsfragment".
aa81b705 tests: regenerate SLOWEST_TESTS.
3869a89e EIP-161 collect_touched_accounts(): remove computation.is_origin_computation when considering SELFDESTRUCT beneficiaries + refactor.
516a94e9 EIP-161 collect_touched_accounts(): clean up.
0457d814 EIP-161: don't collect if nested computation errored.
9d5ffd49 EIP-161 collect_touched_accounts(): relax to geth's level.
b7c9cdd2 fixtures: switch to tag v7.0.0-beta.1.
a5bdeaec mark some tests as incorrect
6a43adef Some fixtures do not have post state. Added a normalizer `normalize_post_stae` to handle this case. renamed existing method `normalize_post_state` to `normalize_post_state_hash`
807109b4 add istanbul blockchain tests to CI
c93ec1a5 mark randomStatetest94 as slow tests
a3244cda update gas for create_empty_contract
a1315d79 change ByzantiumToConstantinopleAt5 to ByzantiumToConstantinopleFixAt5
16a49ae6 add more gas for sstore_uint64 tests
090053d9 updated fixtures and handle case when postState is a string
fcce01c9 update upstream tests for Istanbul

@veox veox force-pushed the update-fixtures-to-v7.0.0-beta.1-rebased branch from 3cd92a1 to 84b5bb7 Compare October 10, 2019 13:56
@voith
Copy link
Contributor

voith commented Oct 15, 2019

@veox Great work! 👍

@veox veox force-pushed the update-fixtures-to-v7.0.0-beta.1-rebased branch from 6e7aae7 to 332e4c5 Compare October 31, 2019 12:31
@veox veox force-pushed the update-fixtures-to-v7.0.0-beta.1-rebased branch from c729949 to eb8051f Compare November 4, 2019 13:20
voith and others added 16 commits November 4, 2019 15:21
…ost_stae` to handle this

case. renamed existing method `normalize_post_state` to `normalize_post_state_hash`
Since geth is now filling the tests, we have to do it like geth:

Walk the entire computation tree, including branches that errored
out (got REVERTed, OOGed, etc.), looking for wabbit RIPEMD160,
_always_ collecting it. Skip everything else on errored branches.

SQUASHED:

tests: fix import when DEBUG2 logging.

Logging utilities have moved to separate package, eth_utils.
In the general non-RIPEMD160 case, if the computation errored, it
would still be collected, because of the computation.is_origin_computation
condition.
Now that `computation.is_origin_computation` no longer needs to
be considered, it's fine to move the RIPEMD160 special-casing
back into the `if` clause, because the condition is the same.
…utation when considering SELFDESTRUCT beneficiaries + refactor.

`computation.is_origin_computation` has been present since the file was first introduced by @pipermerriam:

ethereum@69a8385#diff-28f7a9ef4182d19a95f4cccb1c073ef3

However, whether it's present or not has no effect on the tests passing.

(Possibly, this is due to the case not being covered in the tests...)

I can't find a place which explicitly states that beneficiary collection
should only be skipped if the error happened in the origin computation.

From the fact that having a `computation.is_origin_computation` in the
next if-clause (`if computation.msg.to != constants.CREATE_CONTRACT_ADDRESS`)
caused an error in a RevertPrecompiledTouchExactOOG test, it would seem
that upstream (geth v1.9.6) does not consider this a necessary condition.

Therefore, removing the condition here, too; and re-working the if-else
clauses to look like they did previously (moving the RIPEMD160 special-casing
as a sub-clause of the main clause).
Used these napkin-quality scripts:

https://gist.github.com/veox/02336c518f049cb749608657622d127f

SQUASHED:

tests: add Istanbul variants to existing SLOWEST_TESTS + CALLBlake2f_MaxRounds.

GeneralStateTests/stTimeConsuming/CALLBlake2f_MaxRounds.json takes an awful long
time - I was never able to run it fully.

Beyond that, file names for some previous slow tests have changed, losing a
`_dXgYvZ` qualifier.

Not all have been reviewed! Just enough for the BlockchainTests to run Istanbul
within half an hour on my workstation.

tests: mark `randomStatetest94` as slow for Istanbul, too.

Test passes, takes 22 seconds to run in py-evm (checked for Istanbul only),
and indeed causes a +3 GiB memory use peak on my workstation - similar to
`geth`, as reported here:

https://gitter.im/ethereum/tests?at=5d8c6d25b38cc849bf1402fe

(Not as time-consuming as some other tests, though.)
@veox veox force-pushed the update-fixtures-to-v7.0.0-beta.1-rebased branch from eb8051f to 2a641b7 Compare November 4, 2019 13:38
@veox veox force-pushed the update-fixtures-to-v7.0.0-beta.1-rebased branch from 2a641b7 to 3abcda8 Compare November 4, 2019 13:45
`towncrier --draft` shows that newsfragments in the `misc` category
don't get their contents displayed, they just get listed with a link in
the "Miscellaneous internal" section.

This is unacceptable! Move to `bugfix` section instead.
@carver
Copy link
Contributor

carver commented Nov 5, 2019

Thanks to both of you!

I squashed a couple commits to have the history a bit cleaner (doing my best to retain commit history). The squashed version is here: #1871

I'll close this for now, to be merged by that squashed PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking: some upstream test fixtures fail when updating to v7.0.0-beta.1
3 participants