-
Notifications
You must be signed in to change notification settings - Fork 998
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
Move deposit contract back #1127
Conversation
1. Add `install_deposit_contract_test` command 2. Add `test_deposit_contract` command
.circleci/config.yml
Outdated
- deposit_contract: | ||
requires: | ||
- install_env | ||
- lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why require lint
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the race condition of venv
:'( #1081
I will think more about how to make it in parallel...
Do we want to get this merged or is there anything else you want to handle in this PR? |
The CI caching problems may be because of the formatting of the cache string. (two checksums to pop through when finding the cache). It's tempting to just copy over the dependencies from the basic requirements file tot the requirements-testing, instead of importing it from within. Then we can just use the standard single-checksum cache key. If you like we can try it in this PR. Test-generators don't run in CI. Mainnet tests are big, and writing half a GB worth of yaml is not worth it every push to CI. Instead, state-transition test generation is unified with testing; when testing, it runs in a pytest context, and doesn't output yaml. |
Do you mean in reqs_checksum: cache-v1-{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "test_libs/pyspec/requirements-testing.txt" }}-{{ checksum "deposit_contract/requirements-testing.txt" }} Sorry I'm not sure why it causes the problem since they are all static txt files, and what do you mean by "just copy over the dependencies from the basic requirements file"? Could you give an example? 😃 And @djrtwo @protolambda |
@hwwhww I meant the opposite. Simplification. That is, change the current -r requirements.txt
pytest>=3.6,<3.7
../config_helpers to: eth-utils>=1.3.0,<2
eth-typing>=2.1.0,<3.0.0
pycryptodome==3.7.3
py_ecc>=1.6.0
typing_inspect==0.4.0
pytest>=3.6,<3.7
../config_helpers and have one less checksum to worry about, as caching problems seem to be worse than copying over a few dependencies rarely.
If it's a different venv, we should NOT include its checksum in the cache key. We're effectively taking the hash of the version numbers to version the cache of the downloaded dependencies of those version numbers. If the deposit contract requirements are used in a separate venv, then they should be cached separately. Also, when incrementing a cache version number, it would look like: Also note that the key is prefix based, so incrementing to |
.circleci/config.yml
Outdated
- restore_cached_venv: | ||
venv_name: v1-pyspec-03 | ||
reqs_checksum: '{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "test_libs/pyspec/requirements-testing.txt" }}' | ||
- restore_default_cached_venv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Let's not mingle caches of different venvs, there's no "default"
- Let's reduce the checksum complexity to 1 hash, and follow the standard
- Let's don't use double version tickers in the caching key
- Multiple parts split by a
-
are likely the root of the cache-key problems. See point 2.
Caching is a nightmare sometimes, but we can get this right :)
Marking this PR as blocked for now, caching is not quite ready to merge currently.
Agreed and disagreed some points. 😄🤓 tl;dr
The ideal CI workflow in my mind would be:
But unfortunately, due to the race condition (#1081), all jobs are executed sequentially… :’( So that’s what we have now:
If we want to make deposit_contract in another
^^^^ IMO That would increase some redundant jobs and make CircleCI config more complicated. Do you feel strongly that it should be in separate
Ohh the
I can see how “just copy over the dependencies from the basic requirements file” make it in one checksum (although I think it doesn't solve the problem above 😄). But anyway, if we want to keep deposit contract in the same Here are some recommendations from CircleCI doc:
Agreed! 👍
It looks like as same as your point 2? Also not sure why that’s a problem. Any link? :) |
I'm not sure about the issues in CI aside from linting running on the wrong version. But hyphens cause the CI to fall back on keys with the same prefix (up to any hyphen), which may be the reason / co-factor of dependencies of the 2nd checksum not being installed as expected. Circle CI docs here: https://circleci.com/docs/2.0/caching/#restoring-cache, note the "partial cache restore", we should re-run the dependcies install on top of the restored cache contents.
The previous CI helper functions where there to make it easy to implement storing + restoring of additional venvs. The generators never made it due to speed & parallellization issues in the CI environment, but we may have others in the future. (contract testing?). Hence the preference to not call anything "default", and just make things explicit.
Looks good! The current reason to stick with I'm going to try and fix the linting dependency blocking #1077 by moving the linting install out of the makefile, into the testing requirements. (We could make a 3rd requirements file for non-runtime deps, or another bigger change, but really just need to unblock the PR). |
@protolambda @hwwhww I believe one of you was going to make a change to the circleci config before this merged. Is that correct? |
@protolambda @djrtwo Sorry for the delay, I was traveling yesterday. (Decided to push commit into this branch to get review easier 😅) here is the new config: And the new workflow: Ready for another look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Why not just create a separate venv? It's much simpler and cleaner (no caching of separate cache of same venv) Say, the location would be in circle ci config: venv_path: ./deposit_contract/venv Then we have a clear consistent reproducible venv locally. And there would be no need to clear and refresh the venv of pyspec when you're working on different things and switching feature branches, as they are separate. |
PR feedback + bump eth-tester
I was thinking about efficiency and the use case of testing deposit contract is rare. But after I created a new venv as you said, Ready for another look. :) |
Regarding that last 1-line addition: I declared the new targets (and 1 missing one: |
Fix #980
Changelogs
minimal_ssz
andDepositData
.install_deposit_contract_test
command to install the testing requirements ofdeposit_contract
test_deposit_contract
command to run thedeposit_contract
testsrestore_default_cached_venv
andsave_default_cached_venv
to avoid settingvenv_name
andreqs_checksum
in multiple places.TODOs
make clean && make pyspec && make install_test && make install_deposit_contract_test && make test_deposit_contract
on my local side.pip3 install -r requirements-testing.txt
intest_deposit_contract
command.test_generators
deal with it in CI?venv_name
andreqs_checksum
in CiricleCI config?