WIP: add solidity deposit contract CI workflow
Export `DAPP_LIB` Fix .gitmodules update CI solc version Kick cache Make metadata remain the same
This commit is contained in:
parent
487d19ccb1
commit
80fb126401
|
@ -145,54 +145,95 @@ jobs:
|
||||||
- run:
|
- run:
|
||||||
name: Run linter
|
name: Run linter
|
||||||
command: make lint
|
command: make lint
|
||||||
install_deposit_contract_compiler:
|
# 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:
|
||||||
docker:
|
docker:
|
||||||
# The deposit contract compiler is pinned to python 3.7 because of the vyper version pin.
|
- image: ethereum/solc:0.6.11-alpine
|
||||||
- image: circleci/python:3.7
|
|
||||||
working_directory: ~/specs-repo
|
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- checkout
|
||||||
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
|
|
||||||
- restore_deposit_contract_compiler_cached_venv
|
|
||||||
- run:
|
- run:
|
||||||
name: Install deposit contract compiler requirements
|
name: Install build essentials
|
||||||
command: make install_deposit_contract_compiler
|
command: |
|
||||||
- save_deposit_contract_compiler_cached_venv
|
apk update
|
||||||
install_deposit_contract_tester:
|
apk add git make
|
||||||
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:
|
- run:
|
||||||
name: Install deposit contract tester requirements
|
name: Compile the contract
|
||||||
command: make install_deposit_contract_tester
|
command: |
|
||||||
- save_deposit_contract_tester_cached_venv
|
make compile_deposit_contract
|
||||||
test_compile_deposit_contract:
|
git diff --color --exit-code
|
||||||
docker:
|
- persist_to_workspace:
|
||||||
- image: circleci/python:3.7
|
root: .
|
||||||
working_directory: ~/specs-repo
|
paths:
|
||||||
steps:
|
- ./solidity_deposit_contract/deposit_contract.json
|
||||||
- restore_cache:
|
- ./build/combined.json
|
||||||
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
|
- ./solidity_deposit_contract/lib
|
||||||
- restore_deposit_contract_compiler_cached_venv
|
|
||||||
- run:
|
|
||||||
name: Run deposit contract compile test
|
|
||||||
command: make test_compile_deposit_contract
|
|
||||||
test_deposit_contract:
|
test_deposit_contract:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/python:3.8
|
- image: nixorg/nix:circleci
|
||||||
working_directory: ~/specs-repo
|
|
||||||
steps:
|
steps:
|
||||||
|
- checkout
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
|
key: nix-store-test-v2
|
||||||
- restore_deposit_contract_tester_cached_venv
|
- attach_workspace:
|
||||||
|
at: /tmp/
|
||||||
- run:
|
- run:
|
||||||
name: Run deposit contract test
|
name: Test the contract
|
||||||
command: make test_deposit_contract
|
command: |
|
||||||
|
mkdir build
|
||||||
|
cp -r /tmp/build/* build
|
||||||
|
cp -r /tmp/solidity_deposit_contract/lib/* ./solidity_deposit_contract/lib
|
||||||
|
cp -r /tmp/solidity_deposit_contract/deposit_contract.json ./solidity_deposit_contract/deposit_contract.json
|
||||||
|
nix-shell --command 'make test_deposit_contract' ./solidity_deposit_contract/shell.nix
|
||||||
|
- save_cache:
|
||||||
|
key: nix-store-test-v2
|
||||||
|
paths:
|
||||||
|
- /nix
|
||||||
workflows:
|
workflows:
|
||||||
version: 2.1
|
version: 2.1
|
||||||
test_spec:
|
test_spec:
|
||||||
|
@ -209,15 +250,21 @@ workflows:
|
||||||
- lint:
|
- lint:
|
||||||
requires:
|
requires:
|
||||||
- test
|
- test
|
||||||
- install_deposit_contract_compiler:
|
# - install_deposit_contract_compiler:
|
||||||
requires:
|
# requires:
|
||||||
- checkout_specs
|
# - checkout_specs
|
||||||
- test_compile_deposit_contract:
|
# - test_compile_deposit_contract:
|
||||||
requires:
|
# requires:
|
||||||
- install_deposit_contract_compiler
|
# - install_deposit_contract_compiler
|
||||||
- install_deposit_contract_tester:
|
# - install_deposit_contract_tester:
|
||||||
requires:
|
# requires:
|
||||||
- checkout_specs
|
# - checkout_specs
|
||||||
|
# - test_deposit_contract:
|
||||||
|
# requires:
|
||||||
|
# - install_deposit_contract_tester
|
||||||
|
build_and_test_deposit_contract:
|
||||||
|
jobs:
|
||||||
|
- build_deposit_contract
|
||||||
- test_deposit_contract:
|
- test_deposit_contract:
|
||||||
requires:
|
requires:
|
||||||
- install_deposit_contract_tester
|
- build_deposit_contract
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
*.vy linguist-language=Python
|
*.vy linguist-language=Python
|
||||||
|
*.sol linguist-language=Solidity
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[submodule "lib/ds-test"]
|
[submodule "lib/ds-test"]
|
||||||
path = lib/ds-test
|
path = solidity_deposit_contract/lib/ds-test
|
||||||
url = https://github.com/dapphub/ds-test
|
url = https://github.com/dapphub/ds-test
|
35
Makefile
35
Makefile
|
@ -6,6 +6,9 @@ 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
|
DEPOSIT_CONTRACT_TESTER_DIR = ./deposit_contract/tester
|
||||||
|
SOLIDITY_DEPOSIT_CONTRACT_DIR = ./solidity_deposit_contract
|
||||||
|
SOLIDITY_DEPOSIT_CONTRACT_SOURCE = ${SOLIDITY_DEPOSIT_CONTRACT_DIR}/deposit_contract.sol
|
||||||
|
SOLIDITY_FILE_NAME = deposit_contract.json
|
||||||
CONFIGS_DIR = ./configs
|
CONFIGS_DIR = ./configs
|
||||||
|
|
||||||
# Collect a list of generator names
|
# Collect a list of generator names
|
||||||
|
@ -25,6 +28,11 @@ COV_INDEX_FILE=$(PY_SPEC_DIR)/$(COV_HTML_OUT)/index.html
|
||||||
CURRENT_DIR = ${CURDIR}
|
CURRENT_DIR = ${CURDIR}
|
||||||
LINTER_CONFIG_FILE = $(CURRENT_DIR)/linter.ini
|
LINTER_CONFIG_FILE = $(CURRENT_DIR)/linter.ini
|
||||||
|
|
||||||
|
export DAPP_SKIP_BUILD:=1
|
||||||
|
export DAPP_SRC:=$(SOLIDITY_DEPOSIT_CONTRACT_DIR)
|
||||||
|
export DAPP_LIB:=$(SOLIDITY_DEPOSIT_CONTRACT_DIR)/lib
|
||||||
|
export DAPP_JSON:=build/combined.json
|
||||||
|
|
||||||
.PHONY: clean partial_clean all test citest lint generate_tests pyspec install_test open_cov \
|
.PHONY: clean partial_clean all test citest lint generate_tests pyspec install_test open_cov \
|
||||||
install_deposit_contract_tester test_deposit_contract install_deposit_contract_compiler \
|
install_deposit_contract_tester test_deposit_contract install_deposit_contract_compiler \
|
||||||
compile_deposit_contract test_compile_deposit_contract check_toc
|
compile_deposit_contract test_compile_deposit_contract check_toc
|
||||||
|
@ -107,23 +115,28 @@ 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:
|
# install_deposit_contract_tester:
|
||||||
cd $(DEPOSIT_CONTRACT_TESTER_DIR); python3 -m venv venv; . venv/bin/activate; pip3 install -r requirements.txt
|
# cd $(DEPOSIT_CONTRACT_TESTER_DIR); python3 -m venv venv; . venv/bin/activate; pip3 install -r requirements.txt
|
||||||
|
|
||||||
test_deposit_contract:
|
test_deposit_contract:
|
||||||
cd $(DEPOSIT_CONTRACT_TESTER_DIR); . venv/bin/activate; \
|
dapp test -v --fuzz-runs 5
|
||||||
python -m pytest .
|
|
||||||
|
|
||||||
install_deposit_contract_compiler:
|
# install_deposit_contract_compiler:
|
||||||
cd $(DEPOSIT_CONTRACT_COMPILER_DIR); python3.7 -m venv venv; . venv/bin/activate; pip3.7 install -r requirements.txt
|
# 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 $(DEPOSIT_CONTRACT_COMPILER_DIR); . venv/bin/activate; \
|
@cd $(SOLIDITY_DEPOSIT_CONTRACT_DIR)
|
||||||
python3.7 deposit_contract/compile.py ../contracts/validator_registration.vy
|
@git submodule update --recursive --init
|
||||||
|
@solc --metadata-literal --optimize --optimize-runs 5000000 --bin --abi --combined-json=abi,bin,bin-runtime,srcmap,srcmap-runtime,ast,metadata,storage-layout --overwrite -o build $(SOLIDITY_DEPOSIT_CONTRACT_SOURCE) $(SOLIDITY_DEPOSIT_CONTRACT_DIR)/tests/deposit_contract.t.sol
|
||||||
|
@/bin/echo -n '{"abi": ' > $(SOLIDITY_FILE_NAME)
|
||||||
|
@cat build/DepositContract.abi >> $(SOLIDITY_FILE_NAME)
|
||||||
|
@/bin/echo -n ', "bytecode": "0x' >> $(SOLIDITY_FILE_NAME)
|
||||||
|
@cat build/DepositContract.bin >> $(SOLIDITY_FILE_NAME)
|
||||||
|
@/bin/echo -n '"}' >> $(SOLIDITY_FILE_NAME)
|
||||||
|
|
||||||
test_compile_deposit_contract:
|
# test_compile_deposit_contract:
|
||||||
cd $(DEPOSIT_CONTRACT_COMPILER_DIR); . venv/bin/activate; \
|
# cd $(DEPOSIT_CONTRACT_COMPILER_DIR); . venv/bin/activate; \
|
||||||
python3.7 -m pytest .
|
# python3.7 -m pytest .
|
||||||
|
|
||||||
# Runs a generator, identified by param 1
|
# Runs a generator, identified by param 1
|
||||||
define run_generator
|
define run_generator
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
*.sol linguist-language=Solidity
|
|
Loading…
Reference in New Issue