diff --git a/.gitignore b/.gitignore index 909996e73..ce047240a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ yaml_tests/ .pytest_cache # Dynamically built from Markdown spec -test_libs/pyspec/pyspec/phase0/spec.py +test_libs/pyspec/eth2spec/phase0/spec.py diff --git a/Makefile b/Makefile index 34d347118..bf23a1442 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ GENERATORS = $(sort $(dir $(wildcard $(GENERATOR_DIR)/*/))) YAML_TEST_TARGETS = $(patsubst $(GENERATOR_DIR)/%, $(YAML_TEST_DIR)/%, $(GENERATORS)) GENERATOR_VENVS = $(patsubst $(GENERATOR_DIR)/%, $(GENERATOR_DIR)/%venv, $(GENERATORS)) -PY_SPEC_PHASE_0_TARGETS = $(PY_SPEC_DIR)/pyspec/phase0/spec.py +PY_SPEC_PHASE_0_TARGETS = $(PY_SPEC_DIR)/eth2spec/phase0/spec.py PY_SPEC_ALL_TARGETS = $(PY_SPEC_PHASE_0_TARGETS) @@ -40,7 +40,7 @@ pyspec: $(PY_SPEC_ALL_TARGETS) phase0: $(PY_SPEC_PHASE_0_TARGETS) -$(PY_SPEC_DIR)/pyspec/phase0/spec.py: +$(PY_SPEC_DIR)/eth2spec/phase0/spec.py: python3 $(SCRIPT_DIR)/phase0/build_spec.py $(SPEC_DIR)/core/0_beacon-chain.md $@ diff --git a/README.md b/README.md index d68c55cf3..e575aebd6 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,6 @@ The following are the broad design goals for Ethereum 2.0: Documentation on the different components used during spec writing can be found here: * [YAML Test Generators](test_generators/README.md) -* [Executable Python Spec](test_libs/pyspec/README.md) +* [Executable Python Spec](test_libs/eth2spec/README.md) * [Py-tests](py_tests/README.md) diff --git a/py_tests/phase0/block_processing/test_process_attestation.py b/py_tests/phase0/block_processing/test_process_attestation.py index d454d6be4..bd4c7da12 100644 --- a/py_tests/phase0/block_processing/test_process_attestation.py +++ b/py_tests/phase0/block_processing/test_process_attestation.py @@ -1,12 +1,12 @@ from copy import deepcopy import pytest -import pyspec.phase0.spec as spec +import eth2spec.phase0.spec as spec -from pyspec.phase0.state_transition import ( +from eth2spec.phase0.state_transition import ( state_transition, ) -from pyspec.phase0.spec import ( +from eth2spec.phase0.spec import ( get_current_epoch, process_attestation, slot_to_epoch, diff --git a/py_tests/phase0/block_processing/test_process_attester_slashing.py b/py_tests/phase0/block_processing/test_process_attester_slashing.py index b1f836a29..5c97eb97b 100644 --- a/py_tests/phase0/block_processing/test_process_attester_slashing.py +++ b/py_tests/phase0/block_processing/test_process_attester_slashing.py @@ -1,8 +1,8 @@ from copy import deepcopy import pytest -import pyspec.phase0.spec as spec -from pyspec.phase0.spec import ( +import eth2spec.phase0.spec as spec +from eth2spec.phase0.spec import ( get_balance, get_beacon_proposer_index, process_attester_slashing, diff --git a/py_tests/phase0/block_processing/test_process_block_header.py b/py_tests/phase0/block_processing/test_process_block_header.py index 6c40260d5..0ffc6f613 100644 --- a/py_tests/phase0/block_processing/test_process_block_header.py +++ b/py_tests/phase0/block_processing/test_process_block_header.py @@ -2,7 +2,7 @@ from copy import deepcopy import pytest -from pyspec.phase0.spec import ( +from eth2spec.phase0.spec import ( get_beacon_proposer_index, cache_state, advance_slot, diff --git a/py_tests/phase0/block_processing/test_process_deposit.py b/py_tests/phase0/block_processing/test_process_deposit.py index cf911e29a..a424e2846 100644 --- a/py_tests/phase0/block_processing/test_process_deposit.py +++ b/py_tests/phase0/block_processing/test_process_deposit.py @@ -1,9 +1,9 @@ from copy import deepcopy import pytest -import pyspec.phase0.spec as spec +import eth2spec.phase0.spec as spec -from pyspec.phase0.spec import ( +from eth2spec.phase0.spec import ( get_balance, ZERO_HASH, process_deposit, diff --git a/py_tests/phase0/block_processing/test_process_proposer_slashing.py b/py_tests/phase0/block_processing/test_process_proposer_slashing.py index 3c3208b87..51e56bf70 100644 --- a/py_tests/phase0/block_processing/test_process_proposer_slashing.py +++ b/py_tests/phase0/block_processing/test_process_proposer_slashing.py @@ -1,8 +1,8 @@ from copy import deepcopy import pytest -import pyspec.phase0.spec as spec -from pyspec.phase0.spec import ( +import eth2spec.phase0.spec as spec +from eth2spec.phase0.spec import ( get_balance, get_current_epoch, process_proposer_slashing, diff --git a/py_tests/phase0/block_processing/test_voluntary_exit.py b/py_tests/phase0/block_processing/test_voluntary_exit.py index e7457126d..51b44b5dc 100644 --- a/py_tests/phase0/block_processing/test_voluntary_exit.py +++ b/py_tests/phase0/block_processing/test_voluntary_exit.py @@ -1,9 +1,9 @@ from copy import deepcopy import pytest -import pyspec.phase0.spec as spec +import eth2spec.phase0.spec as spec -from pyspec.phase0.spec import ( +from eth2spec.phase0.spec import ( get_active_validator_indices, get_current_epoch, process_voluntary_exit, diff --git a/py_tests/phase0/conftest.py b/py_tests/phase0/conftest.py index fb866160a..ec499862c 100644 --- a/py_tests/phase0/conftest.py +++ b/py_tests/phase0/conftest.py @@ -1,6 +1,6 @@ import pytest -from pyspec.phase0 import spec +from eth2spec.phase0 import spec from .helpers import ( create_genesis_state, diff --git a/py_tests/phase0/helpers.py b/py_tests/phase0/helpers.py index 9ca05ba97..8ef6b5329 100644 --- a/py_tests/phase0/helpers.py +++ b/py_tests/phase0/helpers.py @@ -2,9 +2,9 @@ from copy import deepcopy from py_ecc import bls -import pyspec.phase0.spec as spec -from pyspec.utils.minimal_ssz import signed_root -from pyspec.phase0.spec import ( +import eth2spec.phase0.spec as spec +from eth2spec.utils.minimal_ssz import signed_root +from eth2spec.phase0.spec import ( # constants EMPTY_SIGNATURE, ZERO_HASH, @@ -35,7 +35,7 @@ from pyspec.phase0.spec import ( verify_merkle_branch, hash, ) -from pyspec.utils.merkle_minimal import ( +from eth2spec.utils.merkle_minimal import ( calc_merkle_tree_from_leaves, get_merkle_proof, get_merkle_root, diff --git a/py_tests/phase0/test_sanity.py b/py_tests/phase0/test_sanity.py index 3ca390547..8c30b62f0 100644 --- a/py_tests/phase0/test_sanity.py +++ b/py_tests/phase0/test_sanity.py @@ -3,10 +3,10 @@ from copy import deepcopy import pytest from py_ecc import bls -import pyspec.phase0.spec as spec +import eth2spec.phase0.spec as spec -from pyspec.utils.minimal_ssz import signed_root -from pyspec.phase0.spec import ( +from eth2spec.utils.minimal_ssz import signed_root +from eth2spec.phase0.spec import ( # constants EMPTY_SIGNATURE, ZERO_HASH, @@ -28,10 +28,10 @@ from pyspec.phase0.spec import ( verify_merkle_branch, hash, ) -from pyspec.phase0.state_transition import ( +from eth2spec.phase0.state_transition import ( state_transition, ) -from pyspec.utils.merkle_minimal import ( +from eth2spec.utils.merkle_minimal import ( calc_merkle_tree_from_leaves, get_merkle_proof, get_merkle_root, diff --git a/scripts/phase0/build_spec.py b/scripts/phase0/build_spec.py index 8ec57d56d..fa7d1fb68 100644 --- a/scripts/phase0/build_spec.py +++ b/scripts/phase0/build_spec.py @@ -13,8 +13,8 @@ from typing import ( NewType, Tuple, ) -from pyspec.utils.minimal_ssz import * -from pyspec.utils.bls_stub import * +from eth2spec.utils.minimal_ssz import * +from eth2spec.utils.bls_stub import * """) diff --git a/test_generators/README.md b/test_generators/README.md index 51cca6561..bacb7229a 100644 --- a/test_generators/README.md +++ b/test_generators/README.md @@ -113,7 +113,7 @@ if __name__ == "__main__": And to use the pyspec: ``` -from pyspec.phase0 import spec +from eth2spec.phase0 import spec ``` Recommendations: diff --git a/test_libs/pyspec/README.md b/test_libs/pyspec/README.md index 11ffa835a..08042e746 100644 --- a/test_libs/pyspec/README.md +++ b/test_libs/pyspec/README.md @@ -13,13 +13,13 @@ All the dynamic parts of the spec can be build at once with `make pyspec`. Alternatively, you can build a sub-set of the pyspec: `make phase0`. -Or, to build a single file, specify the path, e.g. `make test_libs/pyspec/pyspec/phase0/spec.py` +Or, to build a single file, specify the path, e.g. `make test_libs/pyspec/eth2spec/phase0/spec.py` ## Contributing Contributions are welcome, but consider implementing your idea as part of the spec itself first. The pyspec is not a replacement. -If you see opportunity to include any of the `pyspec/utils/` code in the spec, +If you see opportunity to include any of the `pyspec/eth2spec/utils/` code in the spec, please submit an issue or PR. ## License diff --git a/test_libs/pyspec/pyspec/__init__.py b/test_libs/pyspec/eth2spec/__init__.py similarity index 100% rename from test_libs/pyspec/pyspec/__init__.py rename to test_libs/pyspec/eth2spec/__init__.py diff --git a/test_libs/pyspec/pyspec/debug/__init__.py b/test_libs/pyspec/eth2spec/debug/__init__.py similarity index 100% rename from test_libs/pyspec/pyspec/debug/__init__.py rename to test_libs/pyspec/eth2spec/debug/__init__.py diff --git a/test_libs/pyspec/pyspec/debug/jsonize.py b/test_libs/pyspec/eth2spec/debug/jsonize.py similarity index 97% rename from test_libs/pyspec/pyspec/debug/jsonize.py rename to test_libs/pyspec/eth2spec/debug/jsonize.py index a77684543..3ea6fe3f5 100644 --- a/test_libs/pyspec/pyspec/debug/jsonize.py +++ b/test_libs/pyspec/eth2spec/debug/jsonize.py @@ -1,4 +1,4 @@ -from pyspec.utils.minimal_ssz import hash_tree_root +from eth2spec.utils.minimal_ssz import hash_tree_root def jsonize(value, typ, include_hash_tree_roots=False): diff --git a/test_libs/pyspec/pyspec/phase0/__init__.py b/test_libs/pyspec/eth2spec/phase0/__init__.py similarity index 100% rename from test_libs/pyspec/pyspec/phase0/__init__.py rename to test_libs/pyspec/eth2spec/phase0/__init__.py diff --git a/test_libs/pyspec/pyspec/phase0/state_transition.py b/test_libs/pyspec/eth2spec/phase0/state_transition.py similarity index 100% rename from test_libs/pyspec/pyspec/phase0/state_transition.py rename to test_libs/pyspec/eth2spec/phase0/state_transition.py diff --git a/test_libs/pyspec/pyspec/utils/__init__.py b/test_libs/pyspec/eth2spec/utils/__init__.py similarity index 100% rename from test_libs/pyspec/pyspec/utils/__init__.py rename to test_libs/pyspec/eth2spec/utils/__init__.py diff --git a/test_libs/pyspec/pyspec/utils/bls_stub.py b/test_libs/pyspec/eth2spec/utils/bls_stub.py similarity index 100% rename from test_libs/pyspec/pyspec/utils/bls_stub.py rename to test_libs/pyspec/eth2spec/utils/bls_stub.py diff --git a/test_libs/pyspec/pyspec/utils/hash_function.py b/test_libs/pyspec/eth2spec/utils/hash_function.py similarity index 100% rename from test_libs/pyspec/pyspec/utils/hash_function.py rename to test_libs/pyspec/eth2spec/utils/hash_function.py diff --git a/test_libs/pyspec/pyspec/utils/merkle_minimal.py b/test_libs/pyspec/eth2spec/utils/merkle_minimal.py similarity index 100% rename from test_libs/pyspec/pyspec/utils/merkle_minimal.py rename to test_libs/pyspec/eth2spec/utils/merkle_minimal.py diff --git a/test_libs/pyspec/pyspec/utils/minimal_ssz.py b/test_libs/pyspec/eth2spec/utils/minimal_ssz.py similarity index 100% rename from test_libs/pyspec/pyspec/utils/minimal_ssz.py rename to test_libs/pyspec/eth2spec/utils/minimal_ssz.py