From 5b8cca831458be07ec8e9a0ca580d60354bfd024 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Fri, 7 Jun 2019 22:19:11 -0400 Subject: [PATCH] deposit_contract/venv PR feedback + bump eth-tester --- .circleci/config.yml | 6 +++--- Makefile | 15 ++++++--------- deposit_contract/README.md | 13 +++++++------ deposit_contract/requirements-testing.txt | 5 ++--- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 91578f861..6b785e6ed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -48,15 +48,15 @@ commands: description: "Restore the cache with deposit_contract keys" steps: - restore_cached_venv: - venv_name: v2-deposit-contract + venv_name: v3-deposit-contract reqs_checksum: cache-{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "deposit_contract/requirements-testing.txt" }} save_deposit_contract_cached_venv: description: Save a venv into a cache with deposit_contract keys" steps: - save_cached_venv: - venv_name: v2-deposit-contract + venv_name: v3-deposit-contract reqs_checksum: cache-{{ checksum "test_libs/pyspec/requirements.txt" }}-{{ checksum "deposit_contract/requirements-testing.txt" }} - venv_path: ./test_libs/pyspec/venv + venv_path: ./deposit_contract/venv jobs: checkout_specs: docker: diff --git a/Makefile b/Makefile index 66c5ba3ec..12b8d79fb 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ clean: rm -rf $(GENERATOR_VENVS) rm -rf $(PY_SPEC_DIR)/venv $(PY_SPEC_DIR)/.pytest_cache rm -rf $(PY_SPEC_ALL_TARGETS) + rm -rf $(DEPOSIT_CONTRACT_DIR)/venv $(DEPOSIT_CONTRACT_DIR)/.pytest_cache # "make gen_yaml_tests" to run generators gen_yaml_tests: $(PY_SPEC_ALL_TARGETS) $(YAML_TEST_TARGETS) @@ -50,19 +51,15 @@ lint: $(PY_SPEC_ALL_TARGETS) cd $(PY_SPEC_DIR); . venv/bin/activate; \ flake8 --ignore=E252,W504,W503 --max-line-length=120 ./eth2spec; +install_deposit_contract_test: + cd $(DEPOSIT_CONTRACT_DIR); python3 -m venv venv; . venv/bin/activate; pip3 install -r requirements-testing.txt + compile_deposit_contract: - cd $(PY_SPEC_DIR); python3 -m venv venv; . venv/bin/activate; \ - cd ../..; cd $(DEPOSIT_CONTRACT_DIR); \ + cd $(DEPOSIT_CONTRACT_DIR); . venv/bin/activate; \ python tool/compile_deposit_contract.py contracts/validator_registration.v.py; -install_deposit_contract_test: - cd $(PY_SPEC_DIR); python3 -m venv venv; . venv/bin/activate; \ - cd ../..; cd $(DEPOSIT_CONTRACT_DIR); \ - pip3 install -r requirements-testing.txt - test_deposit_contract: $(PY_SPEC_ALL_TARGETS) - cd $(PY_SPEC_DIR); python3 -m venv venv; . venv/bin/activate; \ - cd ../.. && cd $(DEPOSIT_CONTRACT_DIR); \ + cd $(DEPOSIT_CONTRACT_DIR); . venv/bin/activate; \ pip3 install -r requirements-testing.txt; \ python -m pytest . diff --git a/deposit_contract/README.md b/deposit_contract/README.md index 266eb93e4..16779e777 100644 --- a/deposit_contract/README.md +++ b/deposit_contract/README.md @@ -1,20 +1,21 @@ # Deposit contract -## How to compile the contract? +## How to set up the testing environment? Under the `eth2.0-specs` directory, execute: +```sh +make install_deposit_contract_test +``` + +## How to compile the contract? + ```sh make compile_deposit_contract ``` The ABI and bytecode will be updated at [`contracts/validator_registration.json`](./contracts/validator_registration.json). -## How to set up the testing environment? - -```sh -make install_deposit_contract_test -``` ## How to run tests? diff --git a/deposit_contract/requirements-testing.txt b/deposit_contract/requirements-testing.txt index c1f96a012..b3a90a88a 100644 --- a/deposit_contract/requirements-testing.txt +++ b/deposit_contract/requirements-testing.txt @@ -1,6 +1,5 @@ -tox==3.0.0 -eth-tester[py-evm]==0.1.0b29 +eth-tester[py-evm]==0.1.0b39 vyper==0.1.0b9 -web3==4.8.3 +web3==5.0.0b2 pytest==3.6.1 ../test_libs/pyspec