Clean up the CI workflow, enable web3.py tests
This commit is contained in:
parent
cd22036c53
commit
377b2e3f83
|
@ -44,32 +44,19 @@ commands:
|
||||||
venv_name: v22-pyspec
|
venv_name: v22-pyspec
|
||||||
reqs_checksum: cache-{{ checksum "setup.py" }}
|
reqs_checksum: cache-{{ checksum "setup.py" }}
|
||||||
venv_path: ./venv
|
venv_path: ./venv
|
||||||
restore_deposit_contract_compiler_cached_venv:
|
|
||||||
description: "Restore the venv from cache for the deposit contract compiler"
|
|
||||||
steps:
|
|
||||||
- restore_cached_venv:
|
|
||||||
venv_name: v23-deposit-contract-compiler
|
|
||||||
reqs_checksum: cache-{{ checksum "deposit_contract/compiler/requirements.txt" }}
|
|
||||||
save_deposit_contract_compiler_cached_venv:
|
|
||||||
description: "Save the venv to cache for later use of the deposit contract compiler"
|
|
||||||
steps:
|
|
||||||
- save_cached_venv:
|
|
||||||
venv_name: v23-deposit-contract-compiler
|
|
||||||
reqs_checksum: cache-{{ checksum "deposit_contract/compiler/requirements.txt" }}
|
|
||||||
venv_path: ./deposit_contract/compiler/venv
|
|
||||||
restore_deposit_contract_tester_cached_venv:
|
restore_deposit_contract_tester_cached_venv:
|
||||||
description: "Restore the venv from cache for the deposit contract tester"
|
description: "Restore the venv from cache for the deposit contract tester"
|
||||||
steps:
|
steps:
|
||||||
- restore_cached_venv:
|
- restore_cached_venv:
|
||||||
venv_name: v22-deposit-contract-tester
|
venv_name: v23-deposit-contract-tester
|
||||||
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "deposit_contract/tester/requirements.txt" }}
|
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "solidity_deposit_contract/web3_tester/requirements.txt" }}
|
||||||
save_deposit_contract_tester_cached_venv:
|
save_deposit_contract_tester_cached_venv:
|
||||||
description: "Save the venv to cache for later use of the deposit contract tester"
|
description: "Save the venv to cache for later use of the deposit contract tester"
|
||||||
steps:
|
steps:
|
||||||
- save_cached_venv:
|
- save_cached_venv:
|
||||||
venv_name: v22-deposit-contract-tester
|
venv_name: v23-deposit-contract-tester
|
||||||
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "deposit_contract/tester/requirements.txt" }}
|
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "solidity_deposit_contract/web3_tester/requirements.txt" }}
|
||||||
venv_path: ./deposit_contract/tester/venv
|
venv_path: ./solidity_deposit_contract/web3_tester/venv
|
||||||
jobs:
|
jobs:
|
||||||
checkout_specs:
|
checkout_specs:
|
||||||
docker:
|
docker:
|
||||||
|
@ -145,53 +132,6 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Run linter
|
name: Run linter
|
||||||
command: make lint
|
command: make lint
|
||||||
# install_deposit_contract_compiler:
|
|
||||||
# docker:
|
|
||||||
# # The deposit contract compiler is pinned to python 3.7 because of the vyper version pin.
|
|
||||||
# - image: circleci/python:3.7
|
|
||||||
# working_directory: ~/specs-repo
|
|
||||||
# steps:
|
|
||||||
# - restore_cache:
|
|
||||||
# key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
|
|
||||||
# - restore_deposit_contract_compiler_cached_venv
|
|
||||||
# - run:
|
|
||||||
# name: Install deposit contract compiler requirements
|
|
||||||
# command: make install_deposit_contract_compiler
|
|
||||||
# - save_deposit_contract_compiler_cached_venv
|
|
||||||
# install_deposit_contract_tester:
|
|
||||||
# docker:
|
|
||||||
# - image: circleci/python:3.8
|
|
||||||
# working_directory: ~/specs-repo
|
|
||||||
# steps:
|
|
||||||
# - restore_cache:
|
|
||||||
# key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
|
|
||||||
# - restore_deposit_contract_tester_cached_venv
|
|
||||||
# - run:
|
|
||||||
# name: Install deposit contract tester requirements
|
|
||||||
# command: make install_deposit_contract_tester
|
|
||||||
# - save_deposit_contract_tester_cached_venv
|
|
||||||
# test_compile_deposit_contract:
|
|
||||||
# docker:
|
|
||||||
# - image: circleci/python:3.7
|
|
||||||
# working_directory: ~/specs-repo
|
|
||||||
# steps:
|
|
||||||
# - restore_cache:
|
|
||||||
# key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
|
|
||||||
# - restore_deposit_contract_compiler_cached_venv
|
|
||||||
# - run:
|
|
||||||
# name: Run deposit contract compile test
|
|
||||||
# command: make test_compile_deposit_contract
|
|
||||||
# test_deposit_contract:
|
|
||||||
# docker:
|
|
||||||
# - image: circleci/python:3.8
|
|
||||||
# working_directory: ~/specs-repo
|
|
||||||
# steps:
|
|
||||||
# - restore_cache:
|
|
||||||
# key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
|
|
||||||
# - restore_deposit_contract_tester_cached_venv
|
|
||||||
# - run:
|
|
||||||
# name: Run deposit contract test
|
|
||||||
# command: make test_deposit_contract
|
|
||||||
build_deposit_contract:
|
build_deposit_contract:
|
||||||
docker:
|
docker:
|
||||||
- image: ethereum/solc:0.6.11-alpine
|
- image: ethereum/solc:0.6.11-alpine
|
||||||
|
@ -234,6 +174,29 @@ jobs:
|
||||||
key: nix-store-test-v2
|
key: nix-store-test-v2
|
||||||
paths:
|
paths:
|
||||||
- /nix
|
- /nix
|
||||||
|
install_deposit_contract_web3_tester:
|
||||||
|
docker:
|
||||||
|
- image: circleci/python:3.8
|
||||||
|
working_directory: ~/specs-repo
|
||||||
|
steps:
|
||||||
|
- restore_cache:
|
||||||
|
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
|
||||||
|
- restore_deposit_contract_tester_cached_venv
|
||||||
|
- run:
|
||||||
|
name: Install deposit contract tester requirements
|
||||||
|
command: make install_deposit_contract_web3_tester
|
||||||
|
- save_deposit_contract_tester_cached_venv
|
||||||
|
test_deposit_contract_web3_tests:
|
||||||
|
docker:
|
||||||
|
- image: circleci/python:3.8
|
||||||
|
working_directory: ~/specs-repo
|
||||||
|
steps:
|
||||||
|
- restore_cache:
|
||||||
|
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
|
||||||
|
- restore_deposit_contract_tester_cached_venv
|
||||||
|
- run:
|
||||||
|
name: Run deposit contract test with web3.py
|
||||||
|
command: make test_deposit_contract_web3_tests
|
||||||
workflows:
|
workflows:
|
||||||
version: 2.1
|
version: 2.1
|
||||||
test_spec:
|
test_spec:
|
||||||
|
@ -250,18 +213,12 @@ workflows:
|
||||||
- lint:
|
- lint:
|
||||||
requires:
|
requires:
|
||||||
- test
|
- test
|
||||||
# - install_deposit_contract_compiler:
|
- install_deposit_contract_web3_tester:
|
||||||
# requires:
|
requires:
|
||||||
# - checkout_specs
|
- checkout_specs
|
||||||
# - test_compile_deposit_contract:
|
- test_deposit_contract_web3_tests:
|
||||||
# requires:
|
requires:
|
||||||
# - install_deposit_contract_compiler
|
- install_deposit_contract_web3_tester
|
||||||
# - install_deposit_contract_tester:
|
|
||||||
# requires:
|
|
||||||
# - checkout_specs
|
|
||||||
# - test_deposit_contract:
|
|
||||||
# requires:
|
|
||||||
# - install_deposit_contract_tester
|
|
||||||
build_and_test_deposit_contract:
|
build_and_test_deposit_contract:
|
||||||
jobs:
|
jobs:
|
||||||
- build_deposit_contract
|
- build_deposit_contract
|
||||||
|
|
23
Makefile
23
Makefile
|
@ -5,10 +5,10 @@ PY_SPEC_DIR = $(TEST_LIBS_DIR)/pyspec
|
||||||
TEST_VECTOR_DIR = ../eth2.0-spec-tests/tests
|
TEST_VECTOR_DIR = ../eth2.0-spec-tests/tests
|
||||||
GENERATOR_DIR = ./tests/generators
|
GENERATOR_DIR = ./tests/generators
|
||||||
DEPOSIT_CONTRACT_COMPILER_DIR = ./deposit_contract/compiler
|
DEPOSIT_CONTRACT_COMPILER_DIR = ./deposit_contract/compiler
|
||||||
DEPOSIT_CONTRACT_TESTER_DIR = ./deposit_contract/tester
|
|
||||||
SOLIDITY_DEPOSIT_CONTRACT_DIR = ./solidity_deposit_contract
|
SOLIDITY_DEPOSIT_CONTRACT_DIR = ./solidity_deposit_contract
|
||||||
SOLIDITY_DEPOSIT_CONTRACT_SOURCE = ${SOLIDITY_DEPOSIT_CONTRACT_DIR}/deposit_contract.sol
|
SOLIDITY_DEPOSIT_CONTRACT_SOURCE = ${SOLIDITY_DEPOSIT_CONTRACT_DIR}/deposit_contract.sol
|
||||||
SOLIDITY_FILE_NAME = deposit_contract.json
|
SOLIDITY_FILE_NAME = deposit_contract.json
|
||||||
|
DEPOSIT_CONTRACT_TESTER_DIR = ${SOLIDITY_DEPOSIT_CONTRACT_DIR}/web3_tester
|
||||||
CONFIGS_DIR = ./configs
|
CONFIGS_DIR = ./configs
|
||||||
|
|
||||||
# Collect a list of generator names
|
# Collect a list of generator names
|
||||||
|
@ -115,15 +115,6 @@ lint: pyspec
|
||||||
flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \
|
flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \
|
||||||
&& mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.phase1
|
&& mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.phase1
|
||||||
|
|
||||||
# install_deposit_contract_tester:
|
|
||||||
# cd $(DEPOSIT_CONTRACT_TESTER_DIR); python3 -m venv venv; . venv/bin/activate; pip3 install -r requirements.txt
|
|
||||||
|
|
||||||
test_deposit_contract:
|
|
||||||
dapp test -v --fuzz-runs 5
|
|
||||||
|
|
||||||
# install_deposit_contract_compiler:
|
|
||||||
# cd $(DEPOSIT_CONTRACT_COMPILER_DIR); python3.7 -m venv venv; . venv/bin/activate; pip3.7 install -r requirements.txt
|
|
||||||
|
|
||||||
compile_deposit_contract:
|
compile_deposit_contract:
|
||||||
@cd $(SOLIDITY_DEPOSIT_CONTRACT_DIR)
|
@cd $(SOLIDITY_DEPOSIT_CONTRACT_DIR)
|
||||||
@git submodule update --recursive --init
|
@git submodule update --recursive --init
|
||||||
|
@ -134,9 +125,15 @@ compile_deposit_contract:
|
||||||
@cat build/DepositContract.bin >> $(SOLIDITY_FILE_NAME)
|
@cat build/DepositContract.bin >> $(SOLIDITY_FILE_NAME)
|
||||||
@/bin/echo -n '"}' >> $(SOLIDITY_FILE_NAME)
|
@/bin/echo -n '"}' >> $(SOLIDITY_FILE_NAME)
|
||||||
|
|
||||||
# test_compile_deposit_contract:
|
test_deposit_contract:
|
||||||
# cd $(DEPOSIT_CONTRACT_COMPILER_DIR); . venv/bin/activate; \
|
dapp test -v --fuzz-runs 5
|
||||||
# python3.7 -m pytest .
|
|
||||||
|
install_deposit_contract_web3_tester:
|
||||||
|
cd $(DEPOSIT_CONTRACT_TESTER_DIR); python3 -m venv venv; . venv/bin/activate; pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
test_deposit_contract_web3_tests:
|
||||||
|
cd $(DEPOSIT_CONTRACT_TESTER_DIR); . venv/bin/activate; \
|
||||||
|
python -m pytest .
|
||||||
|
|
||||||
# Runs a generator, identified by param 1
|
# Runs a generator, identified by param 1
|
||||||
define run_generator
|
define run_generator
|
||||||
|
|
|
@ -15,7 +15,7 @@ DIR = os.path.dirname(__file__)
|
||||||
|
|
||||||
|
|
||||||
def get_deposit_contract_json():
|
def get_deposit_contract_json():
|
||||||
file_path = os.path.join(DIR, '../../contracts/validator_registration.json')
|
file_path = os.path.join(DIR, '../../deposit_contract.json')
|
||||||
deposit_contract_json = open(file_path).read()
|
deposit_contract_json = open(file_path).read()
|
||||||
return json.loads(deposit_contract_json)
|
return json.loads(deposit_contract_json)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from eth2spec.phase0.spec import DepositData
|
||||||
from eth2spec.utils.ssz.ssz_typing import List
|
from eth2spec.utils.ssz.ssz_typing import List
|
||||||
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
|
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
|
||||||
|
|
||||||
from deposit_contract.conftest import (
|
from tests.conftest import (
|
||||||
FULL_DEPOSIT_AMOUNT,
|
FULL_DEPOSIT_AMOUNT,
|
||||||
MIN_DEPOSIT_AMOUNT,
|
MIN_DEPOSIT_AMOUNT,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue