mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-12 11:44:41 +00:00
rename eth2 pkg to pyspec, per request of hww
This commit is contained in:
parent
ab9761bac2
commit
00c3c1e2a6
2
.gitignore
vendored
2
.gitignore
vendored
@ -12,4 +12,4 @@ yaml_tests/
|
|||||||
.pytest_cache
|
.pytest_cache
|
||||||
|
|
||||||
# Dynamically built from Markdown spec
|
# Dynamically built from Markdown spec
|
||||||
test_libs/pyspec/eth2/phase0/spec.py
|
test_libs/pyspec/pyspec/phase0/spec.py
|
||||||
|
8
Makefile
8
Makefile
@ -12,18 +12,18 @@ GENERATORS = $(sort $(dir $(wildcard $(GENERATOR_DIR)/*/)))
|
|||||||
YAML_TEST_TARGETS = $(patsubst $(GENERATOR_DIR)/%, $(YAML_TEST_DIR)/%, $(GENERATORS))
|
YAML_TEST_TARGETS = $(patsubst $(GENERATOR_DIR)/%, $(YAML_TEST_DIR)/%, $(GENERATORS))
|
||||||
GENERATOR_VENVS = $(patsubst $(GENERATOR_DIR)/%, $(GENERATOR_DIR)/%venv, $(GENERATORS))
|
GENERATOR_VENVS = $(patsubst $(GENERATOR_DIR)/%, $(GENERATOR_DIR)/%venv, $(GENERATORS))
|
||||||
|
|
||||||
PY_SPEC_PHASE_0_TARGETS = $(PY_SPEC_DIR)/eth2/phase0/spec.py
|
PY_SPEC_PHASE_0_TARGETS = $(PY_SPEC_DIR)/pyspec/phase0/spec.py
|
||||||
PY_SPEC_ALL_TARGETS = $(PY_SPEC_PHASE_0_TARGETS)
|
PY_SPEC_ALL_TARGETS = $(PY_SPEC_PHASE_0_TARGETS)
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean all test gen_yaml_tests pyspec phase0
|
.PHONY: clean all test gen_yaml_tests pyspec phase0
|
||||||
|
|
||||||
all: $(YAML_TEST_DIR) $(YAML_TEST_TARGETS) $(PY_SPEC_ALL_TARGETS)
|
all: $(PY_SPEC_ALL_TARGETS) $(YAML_TEST_DIR) $(YAML_TEST_TARGETS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(YAML_TEST_DIR)
|
rm -rf $(YAML_TEST_DIR)
|
||||||
rm -rf $(GENERATOR_VENVS)
|
rm -rf $(GENERATOR_VENVS)
|
||||||
rm -rf $(PY_TEST_DIR)/venv
|
rm -rf $(PY_TEST_DIR)/venv $(PY_TEST_DIR)/.pytest_cache
|
||||||
rm -rf $(PY_SPEC_ALL_TARGETS)
|
rm -rf $(PY_SPEC_ALL_TARGETS)
|
||||||
|
|
||||||
# "make gen_yaml_tests" to run generators
|
# "make gen_yaml_tests" to run generators
|
||||||
@ -40,7 +40,7 @@ pyspec: $(PY_SPEC_ALL_TARGETS)
|
|||||||
phase0: $(PY_SPEC_PHASE_0_TARGETS)
|
phase0: $(PY_SPEC_PHASE_0_TARGETS)
|
||||||
|
|
||||||
|
|
||||||
$(PY_SPEC_DIR)/eth2/phase0/spec.py:
|
$(PY_SPEC_DIR)/pyspec/phase0/spec.py:
|
||||||
python3 $(SCRIPT_DIR)/phase0/build_spec.py $(SPEC_DIR)/core/0_beacon-chain.md $@
|
python3 $(SCRIPT_DIR)/phase0/build_spec.py $(SPEC_DIR)/core/0_beacon-chain.md $@
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import eth2.phase0.spec as spec
|
import pyspec.phase0.spec as spec
|
||||||
|
|
||||||
from eth2.phase0.state_transition import (
|
from pyspec.phase0.state_transition import (
|
||||||
state_transition,
|
state_transition,
|
||||||
)
|
)
|
||||||
from eth2.phase0.spec import (
|
from pyspec.phase0.spec import (
|
||||||
get_current_epoch,
|
get_current_epoch,
|
||||||
process_attestation,
|
process_attestation,
|
||||||
slot_to_epoch,
|
slot_to_epoch,
|
||||||
|
@ -2,7 +2,7 @@ from copy import deepcopy
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
from eth2.phase0.spec import (
|
from pyspec.phase0.spec import (
|
||||||
get_beacon_proposer_index,
|
get_beacon_proposer_index,
|
||||||
cache_state,
|
cache_state,
|
||||||
advance_slot,
|
advance_slot,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import eth2.phase0.spec as spec
|
import pyspec.phase0.spec as spec
|
||||||
|
|
||||||
from eth2.phase0.spec import (
|
from pyspec.phase0.spec import (
|
||||||
get_balance,
|
get_balance,
|
||||||
ZERO_HASH,
|
ZERO_HASH,
|
||||||
process_deposit,
|
process_deposit,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import eth2.phase0.spec as spec
|
import pyspec.phase0.spec as spec
|
||||||
from eth2.phase0.spec import (
|
from pyspec.phase0.spec import (
|
||||||
get_balance,
|
get_balance,
|
||||||
get_current_epoch,
|
get_current_epoch,
|
||||||
process_proposer_slashing,
|
process_proposer_slashing,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import eth2.phase0.spec as spec
|
import pyspec.phase0.spec as spec
|
||||||
|
|
||||||
from eth2.phase0.spec import (
|
from pyspec.phase0.spec import (
|
||||||
get_active_validator_indices,
|
get_active_validator_indices,
|
||||||
get_current_epoch,
|
get_current_epoch,
|
||||||
process_voluntary_exit,
|
process_voluntary_exit,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from eth2.phase0 import spec
|
from pyspec.phase0 import spec
|
||||||
|
|
||||||
from .helpers import (
|
from .helpers import (
|
||||||
create_genesis_state,
|
create_genesis_state,
|
||||||
|
@ -2,9 +2,9 @@ from copy import deepcopy
|
|||||||
|
|
||||||
from py_ecc import bls
|
from py_ecc import bls
|
||||||
|
|
||||||
import eth2.phase0.spec as spec
|
import pyspec.phase0.spec as spec
|
||||||
from eth2.utils.minimal_ssz import signed_root
|
from pyspec.utils.minimal_ssz import signed_root
|
||||||
from eth2.phase0.spec import (
|
from pyspec.phase0.spec import (
|
||||||
# constants
|
# constants
|
||||||
EMPTY_SIGNATURE,
|
EMPTY_SIGNATURE,
|
||||||
ZERO_HASH,
|
ZERO_HASH,
|
||||||
@ -33,7 +33,7 @@ from eth2.phase0.spec import (
|
|||||||
verify_merkle_branch,
|
verify_merkle_branch,
|
||||||
hash,
|
hash,
|
||||||
)
|
)
|
||||||
from eth2.utils.merkle_minimal import (
|
from pyspec.utils.merkle_minimal import (
|
||||||
calc_merkle_tree_from_leaves,
|
calc_merkle_tree_from_leaves,
|
||||||
get_merkle_proof,
|
get_merkle_proof,
|
||||||
get_merkle_root,
|
get_merkle_root,
|
||||||
|
@ -3,10 +3,10 @@ from copy import deepcopy
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from py_ecc import bls
|
from py_ecc import bls
|
||||||
import eth2.phase0.spec as spec
|
import pyspec.phase0.spec as spec
|
||||||
|
|
||||||
from eth2.utils.minimal_ssz import signed_root
|
from pyspec.utils.minimal_ssz import signed_root
|
||||||
from eth2.phase0.spec import (
|
from pyspec.phase0.spec import (
|
||||||
# constants
|
# constants
|
||||||
EMPTY_SIGNATURE,
|
EMPTY_SIGNATURE,
|
||||||
ZERO_HASH,
|
ZERO_HASH,
|
||||||
@ -27,10 +27,10 @@ from eth2.phase0.spec import (
|
|||||||
verify_merkle_branch,
|
verify_merkle_branch,
|
||||||
hash,
|
hash,
|
||||||
)
|
)
|
||||||
from eth2.phase0.state_transition import (
|
from pyspec.phase0.state_transition import (
|
||||||
state_transition,
|
state_transition,
|
||||||
)
|
)
|
||||||
from eth2.utils.merkle_minimal import (
|
from pyspec.utils.merkle_minimal import (
|
||||||
calc_merkle_tree_from_leaves,
|
calc_merkle_tree_from_leaves,
|
||||||
get_merkle_proof,
|
get_merkle_proof,
|
||||||
get_merkle_root,
|
get_merkle_root,
|
||||||
|
@ -13,8 +13,8 @@ from typing import (
|
|||||||
NewType,
|
NewType,
|
||||||
Tuple,
|
Tuple,
|
||||||
)
|
)
|
||||||
from eth2.utils.minimal_ssz import *
|
from pyspec.utils.minimal_ssz import *
|
||||||
from eth2.utils.bls_stub import *
|
from pyspec.utils.bls_stub import *
|
||||||
|
|
||||||
|
|
||||||
""")
|
""")
|
||||||
|
@ -113,7 +113,7 @@ if __name__ == "__main__":
|
|||||||
And to use the pyspec:
|
And to use the pyspec:
|
||||||
|
|
||||||
```
|
```
|
||||||
from eth2.phase0 import spec
|
from pyspec.phase0 import spec
|
||||||
```
|
```
|
||||||
|
|
||||||
Recommendations:
|
Recommendations:
|
||||||
|
@ -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`.
|
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/eth2/phase0/spec.py`
|
Or, to build a single file, specify the path, e.g. `make test_libs/pyspec/pyspec/phase0/spec.py`
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Contributions are welcome, but consider implementing your idea as part of the spec itself first.
|
Contributions are welcome, but consider implementing your idea as part of the spec itself first.
|
||||||
The pyspec is not a replacement.
|
The pyspec is not a replacement.
|
||||||
If you see opportunity to include any of the `eth2/utils/` code in the spec,
|
If you see opportunity to include any of the `pyspec/utils/` code in the spec,
|
||||||
please submit an issue or PR.
|
please submit an issue or PR.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from eth2.utils.minimal_ssz import hash_tree_root
|
from pyspec.utils.minimal_ssz import hash_tree_root
|
||||||
|
|
||||||
|
|
||||||
def jsonize(value, typ, include_hash_tree_roots=False):
|
def jsonize(value, typ, include_hash_tree_roots=False):
|
Loading…
x
Reference in New Issue
Block a user