From 4c90c357b728b4e486f29cb4ed169d4652ec52a0 Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 8 Oct 2020 20:34:59 +0200 Subject: [PATCH 01/10] remove yaml duplicates, compress SSZ test outputs --- tests/core/gen_helpers/gen_base/gen_runner.py | 6 ++++-- tests/core/gen_helpers/requirements.txt | 1 + tests/core/gen_helpers/setup.py | 1 + tests/core/pyspec/eth2spec/test/utils.py | 6 +----- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/core/gen_helpers/gen_base/gen_runner.py b/tests/core/gen_helpers/gen_base/gen_runner.py index a22073c00..1cf8ba8cf 100644 --- a/tests/core/gen_helpers/gen_base/gen_runner.py +++ b/tests/core/gen_helpers/gen_base/gen_runner.py @@ -9,6 +9,7 @@ from ruamel.yaml import ( ) from gen_base.gen_typing import TestProvider +from snappy import compress from eth2spec.test import context from eth2spec.test.exceptions import SkippedTest @@ -180,7 +181,8 @@ def dump_yaml_fn(data: Any, name: str, file_mode: str, yaml_encoder: YAML): def dump_ssz_fn(data: AnyStr, name: str, file_mode: str): def dump(case_path: Path): - out_path = case_path / Path(name + '.ssz') + out_path = case_path / Path(name + '.ssz_snappy') + compressed = compress(data) with out_path.open(file_mode + 'b') as f: # write in raw binary mode - f.write(data) + f.write(compressed) return dump diff --git a/tests/core/gen_helpers/requirements.txt b/tests/core/gen_helpers/requirements.txt index e7cdd30ea..a2c194dea 100644 --- a/tests/core/gen_helpers/requirements.txt +++ b/tests/core/gen_helpers/requirements.txt @@ -1,3 +1,4 @@ ruamel.yaml==0.16.5 eth-utils==1.6.0 pytest>=4.4 +python-snappy==0.5.4 diff --git a/tests/core/gen_helpers/setup.py b/tests/core/gen_helpers/setup.py index e9fc1a787..d26530642 100644 --- a/tests/core/gen_helpers/setup.py +++ b/tests/core/gen_helpers/setup.py @@ -7,5 +7,6 @@ setup( "ruamel.yaml==0.16.5", "eth-utils==1.6.0", "pytest>=4.4", + "python-snappy==0.5.4", ] ) diff --git a/tests/core/pyspec/eth2spec/test/utils.py b/tests/core/pyspec/eth2spec/test/utils.py index 12ff68443..306f7d892 100644 --- a/tests/core/pyspec/eth2spec/test/utils.py +++ b/tests/core/pyspec/eth2spec/test/utils.py @@ -39,24 +39,20 @@ def vector_test(description: str = None): if value is None: continue if isinstance(value, View): - yield key, 'data', encode(value) yield key, 'ssz', serialize(value) elif isinstance(value, bytes): - yield key, 'data', encode(value) yield key, 'ssz', value elif isinstance(value, list) and all([isinstance(el, (View, bytes)) for el in value]): for i, el in enumerate(value): if isinstance(el, View): - yield f'{key}_{i}', 'data', encode(el) yield f'{key}_{i}', 'ssz', serialize(el) elif isinstance(el, bytes): - yield f'{key}_{i}', 'data', encode(el) yield f'{key}_{i}', 'ssz', el yield f'{key}_count', 'meta', len(value) else: # Not a ssz value. # The data will now just be yielded as any python data, - # something that should be encodeable by the generator runner. + # something that should be encodable by the generator runner. yield key, 'data', value # check generator mode, may be None/else. From 8bbc5f7fc3967fe2d65680c6450497795aab0b67 Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 8 Oct 2020 21:02:18 +0200 Subject: [PATCH 02/10] update test format docs --- tests/formats/README.md | 28 ++++++++++-------- tests/formats/epoch_processing/README.md | 13 +++------ tests/formats/finality/README.md | 14 ++++----- tests/formats/genesis/initialization.md | 17 ++++------- tests/formats/genesis/validity.md | 5 ++-- tests/formats/operations/README.md | 18 ++++-------- tests/formats/rewards/README.md | 36 ++++++++---------------- tests/formats/sanity/blocks.md | 18 ++++-------- tests/formats/sanity/slots.md | 4 +-- tests/formats/ssz_generic/README.md | 8 +++--- tests/formats/ssz_static/core.md | 8 +++--- 11 files changed, 68 insertions(+), 101 deletions(-) diff --git a/tests/formats/README.md b/tests/formats/README.md index 36a5ec21b..d3933abdd 100644 --- a/tests/formats/README.md +++ b/tests/formats/README.md @@ -132,21 +132,25 @@ Cases are split up too. This enables diffing of parts of the test case, tracking ### `` -E.g. `pre.yaml`, `deposit.yaml`, `post.yaml`. - -Diffing a `pre.yaml` and `post.yaml` provides all the information for testing, good for readability of the change. -Then the difference between pre and post can be compared to anything that changes the pre state, e.g. `deposit.yaml` - These files allow for custom formats for some parts of the test. E.g. something encoded in SSZ. +Or to avoid large files, the SSZ can be compressed with Snappy. +E.g. `pre.ssz_snappy_snappy`, `deposit.ssz_snappy_snappy`, `post.ssz_snappy_snappy`. -Some yaml files have copies, but formatted as raw SSZ bytes: `pre.ssz`, `deposit.ssz`, `post.ssz`. -The yaml files are intended to be deprecated, and clients should shift to ssz inputs for efficiency. -Deprecation will start once a viewer of SSZ test-cases is in place, to maintain a standard of readable test cases. -This also means that some clients can drop legacy YAML -> JSON/other -> SSZ work-arounds. -(These were implemented to support the uint64 YAML, hex strings, etc. Things that were not idiomatic to their language.) +Diffing a `pre.ssz_snappy_snappy` and `post.ssz_snappy_snappy` provides all the information for testing, when decompressed and decoded. +Then the difference between pre and post can be compared to anything that changes the pre state, e.g. `deposit.ssz_snappy_snappy` + +YAML is generally used for test metadata, and for tests that do not use SSZ: e.g. shuffling and BLS tests. +In this case, there is no point in adding special SSZ types. And the size and efficiency of YAML is acceptable. + +#### Common output formats + +Between all types of tests, a few formats are common: + +- **`.yaml`**: A YAML file containing structured data to describe settings or test contents. +- **`.ssz_snappy`**: A file containing raw SSZ-encoded data. Previously widely used in tests, but replaced with compressed variant. +- **`.ssz_snappy_snappy`**: Like `.ssz_snappy`, but compressed with Snappy block compression. + Snappy block compression is already applied to SSZ in Eth2 gossip, available in client implementations, and thus chosen as compression method. -Yaml will not be deprecated for tests that do not use SSZ: e.g. shuffling and BLS tests. -In this case, there is no work around for loading necessary anyway, and the size and efficiency of yaml is acceptable. #### Special output parts diff --git a/tests/formats/epoch_processing/README.md b/tests/formats/epoch_processing/README.md index 57c9441c8..bc15e64b6 100644 --- a/tests/formats/epoch_processing/README.md +++ b/tests/formats/epoch_processing/README.md @@ -15,18 +15,13 @@ description: string -- Optional description of test case, purely for debuggin bls_setting: int -- see general test-format spec. ``` -### `pre.yaml` +### `pre.ssz_snappy` -A YAML-encoded `BeaconState`, the state before running the epoch sub-transition. +A SSZ-snappy encoded `BeaconState`, the state before running the epoch sub-transition. -Also available as `pre.ssz`. +### `post.ssz_snappy` - -### `post.yaml` - -A YAML-encoded `BeaconState`, the state after applying the epoch sub-transition. - -Also available as `post.ssz`. +A SSZ-snappy encoded `BeaconState`, the state after applying the epoch sub-transition. ## Condition diff --git a/tests/formats/finality/README.md b/tests/formats/finality/README.md index da9108a6a..2d279b441 100644 --- a/tests/formats/finality/README.md +++ b/tests/formats/finality/README.md @@ -14,11 +14,11 @@ bls_setting: int -- see general test-format spec. blocks_count: int -- the number of blocks processed in this test. ``` -### `pre.yaml` +### `pre.ssz_snappy` -A YAML-encoded `BeaconState`, the state before running the block transitions. +A SSZ-snappy encoded `BeaconState`, the state before running the block transitions. -Also available as `pre.ssz`. +Also available as `pre.ssz_snappy`. ### `blocks_.yaml` @@ -28,13 +28,11 @@ A series of files, with `` in range `[0, blocks_count)`. Blocks need to b Each file is a YAML-encoded `SignedBeaconBlock`. -Each block is also available as `blocks_.ssz` +Each block is also available as `blocks_.ssz_snappy` -### `post.yaml` +### `post.ssz_snappy` -A YAML-encoded `BeaconState`, the state after applying the block transitions. - -Also available as `post.ssz`. +A SSZ-snappy encoded `BeaconState`, the state after applying the block transitions. ## Condition diff --git a/tests/formats/genesis/initialization.md b/tests/formats/genesis/initialization.md index 428abb5bd..2e5452821 100644 --- a/tests/formats/genesis/initialization.md +++ b/tests/formats/genesis/initialization.md @@ -4,11 +4,9 @@ Tests the initialization of a genesis state based on Eth1 data. ## Test case format -### `eth1_block_hash.yaml` +### `eth1_block_hash.ssz_snappy` -A `Bytes32` hex encoded, with prefix 0x. The root of the Eth1 block. - -Also available as `eth1_block_hash.ssz`. +A SSZ-snappy encoded root of the Eth1 block. ### `eth1_timestamp.yaml` @@ -22,18 +20,15 @@ A yaml file to help read the deposit count: deposits_count: int -- Amount of deposits. ``` -### `deposits_.yaml` +### `deposits_.ssz_snappy` A series of files, with `` in range `[0, deposits_count)`. Deposits need to be processed in order. -Each file is a YAML-encoded `Deposit` object. +Each file is a SSZ-snappy encoded `Deposit` object. -Each deposit is also available as `deposits_.ssz`. +### `state.ssz_snappy` -### `state.yaml` +The expected genesis state. A SSZ-snappy encoded `BeaconState` object. -The expected genesis state. A YAML-encoded `BeaconState` object. - -Also available as `state.ssz`. ## Processing diff --git a/tests/formats/genesis/validity.md b/tests/formats/genesis/validity.md index 38f2b1b1f..1b3f79879 100644 --- a/tests/formats/genesis/validity.md +++ b/tests/formats/genesis/validity.md @@ -4,11 +4,10 @@ Tests if a genesis state is valid, i.e. if it counts as trigger to launch. ## Test case format -### `genesis.yaml` +### `genesis.ssz_snappy` -A `BeaconState`, the state to validate as genesis candidate. +A SSZ-snappy encoded `BeaconState`, the state to validate as genesis candidate. -Also available as `genesis.ssz`. ### `is_valid.yaml` diff --git a/tests/formats/operations/README.md b/tests/formats/operations/README.md index bb4636ec0..ca77ab966 100644 --- a/tests/formats/operations/README.md +++ b/tests/formats/operations/README.md @@ -12,23 +12,17 @@ description: string -- Optional description of test case, purely for debuggin bls_setting: int -- see general test-format spec. ``` -### `pre.yaml` +### `pre.ssz_snappy` -A YAML-encoded `BeaconState`, the state before applying the operation. +A SSZ-snappy encoded `BeaconState`, the state before applying the operation. -Also available as `pre.ssz`. +### `.ssz_snappy` -### `.yaml` +A SSZ-snappy encoded operation object, e.g. a `ProposerSlashing`, or `Deposit`. -A YAML-encoded operation object, e.g. a `ProposerSlashing`, or `Deposit`. +### `post.ssz_snappy` -Also available as `.ssz`. - -### `post.yaml` - -A YAML-encoded `BeaconState`, the state after applying the operation. No value if operation processing is aborted. - -Also available as `post.ssz`. +A SSZ-snappy encoded `BeaconState`, the state after applying the operation. No value if operation processing is aborted. ## Condition diff --git a/tests/formats/rewards/README.md b/tests/formats/rewards/README.md index b229d9f98..aee23c3e9 100644 --- a/tests/formats/rewards/README.md +++ b/tests/formats/rewards/README.md @@ -23,41 +23,29 @@ description: string -- Optional description of test case, purely for debuggin _Note_: No signature verification happens within rewards sub-functions. These tests can safely be run with or without BLS enabled. -### `pre.yaml` +### `pre.ssz_snappy` -A YAML-encoded `BeaconState`, the state before running the rewards sub-function. +A SSZ-snappy encoded `BeaconState`, the state before running the rewards sub-function. -Also available as `pre.ssz`. +### `source_deltas.ssz_snappy` -### `source_deltas.yaml` +A SSZ-snappy encoded `Deltas` representing the rewards and penalties returned by the rewards the `get_source_deltas` function -A YAML-encoded `Deltas` representing the rewards and penalties returned by the rewards the `get_source_deltas` function +### `target_deltas.ssz_snappy` -Also available as `source_deltas.ssz`. +A SSZ-snappy encoded `Deltas` representing the rewards and penalties returned by the rewards the `get_target_deltas` function -### `target_deltas.yaml` +### `head_deltas.ssz_snappy` -A YAML-encoded `Deltas` representing the rewards and penalties returned by the rewards the `get_target_deltas` function +A SSZ-snappy encoded `Deltas` representing the rewards and penalties returned by the rewards the `get_head_deltas` function -Also available as `target_deltas.ssz`. +### `inclusion_delay_deltas.ssz_snappy` -### `head_deltas.yaml` +A SSZ-snappy encoded `Deltas` representing the rewards and penalties returned by the rewards the `get_inclusion_delay_deltas` function -A YAML-encoded `Deltas` representing the rewards and penalties returned by the rewards the `get_head_deltas` function +### `inactivity_penalty_deltas.ssz_snappy` -Also available as `head_deltas.ssz`. - -### `inclusion_delay_deltas.yaml` - -A YAML-encoded `Deltas` representing the rewards and penalties returned by the rewards the `get_inclusion_delay_deltas` function - -Also available as `inclusion_delay_deltas.ssz`. - -### `inactivity_penalty_deltas.yaml` - -A YAML-encoded `Deltas` representing the rewards and penalties returned by the rewards the `get_inactivity_penalty_deltas` function - -Also available as `inactivity_penalty_deltas.ssz`. +A SSZ-snappy encoded `Deltas` representing the rewards and penalties returned by the rewards the `get_inactivity_penalty_deltas` function ## Condition diff --git a/tests/formats/sanity/blocks.md b/tests/formats/sanity/blocks.md index 44b37ed5e..a8b38ccae 100644 --- a/tests/formats/sanity/blocks.md +++ b/tests/formats/sanity/blocks.md @@ -14,27 +14,21 @@ blocks_count: int -- the number of blocks processed in this test. ``` -### `pre.yaml` +### `pre.ssz_snappy` -A YAML-encoded `BeaconState`, the state before running the block transitions. - -Also available as `pre.ssz`. +A SSZ-snappy encoded `BeaconState`, the state before running the block transitions. -### `blocks_.yaml` +### `blocks_.ssz_snappy` A series of files, with `` in range `[0, blocks_count)`. Blocks need to be processed in order, following the main transition function (i.e. process slot and epoch transitions in between blocks as normal) -Each file is a YAML-encoded `SignedBeaconBlock`. +Each file is a SSZ-snappy encoded `SignedBeaconBlock`. -Each block is also available as `blocks_.ssz` +### `post.ssz_snappy` -### `post.yaml` - -A YAML-encoded `BeaconState`, the state after applying the block transitions. - -Also available as `post.ssz`. +A SSZ-snappy encoded `BeaconState`, the state after applying the block transitions. ## Condition diff --git a/tests/formats/sanity/slots.md b/tests/formats/sanity/slots.md index 353287ee2..72a24da51 100644 --- a/tests/formats/sanity/slots.md +++ b/tests/formats/sanity/slots.md @@ -16,7 +16,7 @@ bls_setting: int -- see general test-format spec. A YAML-encoded `BeaconState`, the state before running the transitions. -Also available as `pre.ssz`. +Also available as `pre.ssz_snappy`. ### `slots.yaml` @@ -27,7 +27,7 @@ An integer. The amount of slots to process (i.e. the difference in slots between A YAML-encoded `BeaconState`, the state after applying the transitions. -Also available as `post.ssz`. +Also available as `post.ssz_snappy`. ### Processing diff --git a/tests/formats/ssz_generic/README.md b/tests/formats/ssz_generic/README.md index 68bdbc15f..85a507985 100644 --- a/tests/formats/ssz_generic/README.md +++ b/tests/formats/ssz_generic/README.md @@ -33,7 +33,7 @@ Each of the handlers encodes the SSZ type declaration in the file-name. See [Typ ### `valid` -Valid has 3 parts: `meta.yaml`, `serialized.ssz`, `value.yaml` +Valid has 3 parts: `meta.yaml`, `serialized.ssz_snappy`, `value.yaml` ### `meta.yaml` @@ -46,9 +46,9 @@ root: Bytes32 -- Hash-tree-root of the object The `Bytes32` is encoded as a string, hexadecimal encoding, prefixed with `0x`. -### `serialized.ssz` +### `serialized.ssz_snappy` -The serialized form of the object, as raw SSZ bytes. +The serialized form of the object, as snappy-compressed SSZ bytes. ### `value.yaml` @@ -64,7 +64,7 @@ The conditions are the same for each type: ## `invalid` -Test cases in the `invalid` suite only include the `serialized.ssz` +Test cases in the `invalid` suite only include the `serialized.ssz_snappy` #### Condition diff --git a/tests/formats/ssz_static/core.md b/tests/formats/ssz_static/core.md index d6f99a32b..09ff04e20 100644 --- a/tests/formats/ssz_static/core.md +++ b/tests/formats/ssz_static/core.md @@ -18,7 +18,7 @@ One can iterate over the handlers, and select the type based on the handler name Suites are then the same format, but each specialized in one randomization mode. Some randomization modes may only produce a single test case (e.g. the all-zeroes case). -The output parts are: `roots.yaml`, `serialized.ssz`, `value.yaml` +The output parts are: `roots.yaml`, `serialized.ssz_snappy`, `value.yaml` ### `roots.yaml` @@ -26,13 +26,13 @@ The output parts are: `roots.yaml`, `serialized.ssz`, `value.yaml` root: bytes32 -- string, hash-tree-root of the value, hex encoded, with prefix 0x ``` -### `serialized.ssz` +### `serialized.ssz_snappy` -The raw encoded bytes. +The SSZ-snappy encoded bytes. ### `value.yaml` -The same value as `serialized.ssz`, represented as YAML. +The same value as `serialized.ssz_snappy`, represented as YAML. ## Condition From 3fb9b155518c68222fcef8af36b2bc7c81c230eb Mon Sep 17 00:00:00 2001 From: protolambda Date: Thu, 8 Oct 2020 21:17:13 +0200 Subject: [PATCH 03/10] remove unused imports --- tests/core/pyspec/eth2spec/test/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/core/pyspec/eth2spec/test/utils.py b/tests/core/pyspec/eth2spec/test/utils.py index 306f7d892..bad6c867b 100644 --- a/tests/core/pyspec/eth2spec/test/utils.py +++ b/tests/core/pyspec/eth2spec/test/utils.py @@ -1,5 +1,4 @@ from typing import Dict, Any -from eth2spec.debug.encode import encode from eth2spec.utils.ssz.ssz_typing import View from eth2spec.utils.ssz.ssz_impl import serialize From 91f6956b3a0a6f210ec4d865f47836cde11e24a5 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Wed, 10 Mar 2021 21:55:50 +0800 Subject: [PATCH 04/10] Bump py_ecc to 5.2.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6cfa0910a..efe2f379f 100644 --- a/setup.py +++ b/setup.py @@ -581,7 +581,7 @@ setup( "eth-utils>=1.3.0,<2", "eth-typing>=2.1.0,<3.0.0", "pycryptodome==3.9.4", - "py_ecc==5.1.0", + "py_ecc==5.2.0", "milagro_bls_binding==1.6.3", "dataclasses==0.6", "remerkleable==0.1.18", From 7205f70192b5ec9dc409ee2f99eebef37ea123e1 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Wed, 10 Mar 2021 16:48:53 -0700 Subject: [PATCH 05/10] patch remaining generator docs to reflect snappy_ssz encoding --- tests/formats/README.md | 10 +++++----- tests/formats/forks/README.md | 12 ++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/tests/formats/README.md b/tests/formats/README.md index d3933abdd..7808538ad 100644 --- a/tests/formats/README.md +++ b/tests/formats/README.md @@ -134,10 +134,10 @@ Cases are split up too. This enables diffing of parts of the test case, tracking These files allow for custom formats for some parts of the test. E.g. something encoded in SSZ. Or to avoid large files, the SSZ can be compressed with Snappy. -E.g. `pre.ssz_snappy_snappy`, `deposit.ssz_snappy_snappy`, `post.ssz_snappy_snappy`. +E.g. `pre.ssz_snappy`, `deposit.ssz_snappy`, `post.ssz_snappy`. -Diffing a `pre.ssz_snappy_snappy` and `post.ssz_snappy_snappy` provides all the information for testing, when decompressed and decoded. -Then the difference between pre and post can be compared to anything that changes the pre state, e.g. `deposit.ssz_snappy_snappy` +Diffing a `pre.ssz_snappy` and `post.ssz_snappy` provides all the information for testing, when decompressed and decoded. +Then the difference between pre and post can be compared to anything that changes the pre state, e.g. `deposit.ssz_snappy` YAML is generally used for test metadata, and for tests that do not use SSZ: e.g. shuffling and BLS tests. In this case, there is no point in adding special SSZ types. And the size and efficiency of YAML is acceptable. @@ -147,8 +147,8 @@ In this case, there is no point in adding special SSZ types. And the size and ef Between all types of tests, a few formats are common: - **`.yaml`**: A YAML file containing structured data to describe settings or test contents. -- **`.ssz_snappy`**: A file containing raw SSZ-encoded data. Previously widely used in tests, but replaced with compressed variant. -- **`.ssz_snappy_snappy`**: Like `.ssz_snappy`, but compressed with Snappy block compression. +- **`.ssz`**: A file containing raw SSZ-encoded data. Previously widely used in tests, but replaced with compressed variant. +- **`.ssz_snappy`**: Like `.ssz`, but compressed with Snappy block compression. Snappy block compression is already applied to SSZ in Eth2 gossip, available in client implementations, and thus chosen as compression method. diff --git a/tests/formats/forks/README.md b/tests/formats/forks/README.md index 57cc09227..cbafd4e2a 100644 --- a/tests/formats/forks/README.md +++ b/tests/formats/forks/README.md @@ -24,17 +24,13 @@ Key of valid `fork` strings that might be found in `meta.yaml` | - | - | - | - | | `altair` | Phase 0 | Altair | `upgrade_to_lightclient_patch` | -### `pre.yaml` +### `pre.ssz_snappy` -A YAML-encoded `BeaconState`, the state before running the fork transition. +A SSZ-snappy encoded `BeaconState`, the state before running the fork transition. -Also available as `pre.ssz`. +### `post.ssz_snappy` -### `post.yaml` - -A YAML-encoded `BeaconState`, the state after applying the fork transition. - -Also available as `post.ssz`. +A SSZ-snappy encoded `BeaconState`, the state after applying the fork transition. *Note*: This type is the `BeaconState` after the fork and is *not* the same type as `pre`. From c36106e63060c81760827fd1c740ea77ec3ba37a Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Wed, 10 Mar 2021 17:18:11 -0700 Subject: [PATCH 06/10] put snappy in 'generator' extra dep build and use for generator builds --- setup.py | 2 +- tests/generators/README.md | 2 +- tests/generators/bls/requirements.txt | 2 +- tests/generators/epoch_processing/requirements.txt | 2 +- tests/generators/finality/requirements.txt | 2 +- tests/generators/forks/requirements.txt | 2 +- tests/generators/genesis/requirements.txt | 2 +- tests/generators/operations/requirements.txt | 2 +- tests/generators/rewards/requirements.txt | 2 +- tests/generators/shuffling/requirements.txt | 2 +- tests/generators/ssz_generic/requirements.txt | 2 +- tests/generators/ssz_static/requirements.txt | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index 7923c0a44..aa74fcb05 100644 --- a/setup.py +++ b/setup.py @@ -576,6 +576,7 @@ setup( extras_require={ "test": ["pytest>=4.4", "pytest-cov", "pytest-xdist"], "lint": ["flake8==3.7.7", "mypy==0.750"], + "generator": ["python-snappy==0.5.4"], }, install_requires=[ "eth-utils>=1.3.0,<2", @@ -587,6 +588,5 @@ setup( "remerkleable==0.1.18", "ruamel.yaml==0.16.5", "lru-dict==1.1.6", - "python-snappy==0.5.4", ] ) diff --git a/tests/generators/README.md b/tests/generators/README.md index 0f1ed478f..6ccf9f118 100644 --- a/tests/generators/README.md +++ b/tests/generators/README.md @@ -79,7 +79,7 @@ It's recommended to extend the base-generator. Create a `requirements.txt` in the root of your generator directory: ``` pytest>=4.4 -../../../ +../../../[generator] ``` The config helper and pyspec is optional, but preferred. We encourage generators to derive tests from the spec itself in order to prevent code duplication and outdated tests. diff --git a/tests/generators/bls/requirements.txt b/tests/generators/bls/requirements.txt index df386450b..182248686 100644 --- a/tests/generators/bls/requirements.txt +++ b/tests/generators/bls/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ +../../../[generator] diff --git a/tests/generators/epoch_processing/requirements.txt b/tests/generators/epoch_processing/requirements.txt index df386450b..182248686 100644 --- a/tests/generators/epoch_processing/requirements.txt +++ b/tests/generators/epoch_processing/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ +../../../[generator] diff --git a/tests/generators/finality/requirements.txt b/tests/generators/finality/requirements.txt index df386450b..182248686 100644 --- a/tests/generators/finality/requirements.txt +++ b/tests/generators/finality/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ +../../../[generator] diff --git a/tests/generators/forks/requirements.txt b/tests/generators/forks/requirements.txt index 816df6e63..735f863fa 100644 --- a/tests/generators/forks/requirements.txt +++ b/tests/generators/forks/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ \ No newline at end of file +../../../[generator] \ No newline at end of file diff --git a/tests/generators/genesis/requirements.txt b/tests/generators/genesis/requirements.txt index df386450b..182248686 100644 --- a/tests/generators/genesis/requirements.txt +++ b/tests/generators/genesis/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ +../../../[generator] diff --git a/tests/generators/operations/requirements.txt b/tests/generators/operations/requirements.txt index df386450b..182248686 100644 --- a/tests/generators/operations/requirements.txt +++ b/tests/generators/operations/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ +../../../[generator] diff --git a/tests/generators/rewards/requirements.txt b/tests/generators/rewards/requirements.txt index df386450b..182248686 100644 --- a/tests/generators/rewards/requirements.txt +++ b/tests/generators/rewards/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ +../../../[generator] diff --git a/tests/generators/shuffling/requirements.txt b/tests/generators/shuffling/requirements.txt index df386450b..182248686 100644 --- a/tests/generators/shuffling/requirements.txt +++ b/tests/generators/shuffling/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ +../../../[generator] diff --git a/tests/generators/ssz_generic/requirements.txt b/tests/generators/ssz_generic/requirements.txt index df386450b..182248686 100644 --- a/tests/generators/ssz_generic/requirements.txt +++ b/tests/generators/ssz_generic/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ +../../../[generator] diff --git a/tests/generators/ssz_static/requirements.txt b/tests/generators/ssz_static/requirements.txt index df386450b..182248686 100644 --- a/tests/generators/ssz_static/requirements.txt +++ b/tests/generators/ssz_static/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ +../../../[generator] From 4569ddea5d675ee1e743bc5fc5adf2d889923e96 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Wed, 10 Mar 2021 18:49:50 -0700 Subject: [PATCH 07/10] add missing sanity requirements.txt for generators --- tests/generators/sanity/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/generators/sanity/requirements.txt b/tests/generators/sanity/requirements.txt index df386450b..182248686 100644 --- a/tests/generators/sanity/requirements.txt +++ b/tests/generators/sanity/requirements.txt @@ -1,2 +1,2 @@ pytest>=4.4 -../../../ +../../../[generator] From 69489d1541e973707cccf18f8d4961ab3b945f63 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 11 Mar 2021 21:12:46 +0800 Subject: [PATCH 08/10] Rename folders and file names to `altair` --- configs/mainnet/{lightclient_patch.yaml => altair.yaml} | 0 configs/minimal/{lightclient_patch.yaml => altair.yaml} | 0 specs/{lightclient => altair}/beacon-chain.md | 0 specs/{lightclient => altair}/fork.md | 0 specs/{lightclient => altair}/sync-protocol.md | 0 .../eth2spec/test/{lightclient_patch => altair}/__init__.py | 0 .../{lightclient_patch => altair}/block_processing/__init__.py | 0 .../block_processing/test_process_sync_committee.py | 0 .../{lightclient_patch => altair}/epoch_processing/__init__.py | 0 .../epoch_processing/test_process_sync_committee_updates.py | 0 .../eth2spec/test/{lightclient_patch => altair}/fork/__init__.py | 0 .../eth2spec/test/{lightclient_patch => altair}/fork/test_fork.py | 0 .../test/{lightclient_patch => altair}/sanity/__init__.py | 0 .../test/{lightclient_patch => altair}/sanity/test_blocks.py | 0 14 files changed, 0 insertions(+), 0 deletions(-) rename configs/mainnet/{lightclient_patch.yaml => altair.yaml} (100%) rename configs/minimal/{lightclient_patch.yaml => altair.yaml} (100%) rename specs/{lightclient => altair}/beacon-chain.md (100%) rename specs/{lightclient => altair}/fork.md (100%) rename specs/{lightclient => altair}/sync-protocol.md (100%) rename tests/core/pyspec/eth2spec/test/{lightclient_patch => altair}/__init__.py (100%) rename tests/core/pyspec/eth2spec/test/{lightclient_patch => altair}/block_processing/__init__.py (100%) rename tests/core/pyspec/eth2spec/test/{lightclient_patch => altair}/block_processing/test_process_sync_committee.py (100%) rename tests/core/pyspec/eth2spec/test/{lightclient_patch => altair}/epoch_processing/__init__.py (100%) rename tests/core/pyspec/eth2spec/test/{lightclient_patch => altair}/epoch_processing/test_process_sync_committee_updates.py (100%) rename tests/core/pyspec/eth2spec/test/{lightclient_patch => altair}/fork/__init__.py (100%) rename tests/core/pyspec/eth2spec/test/{lightclient_patch => altair}/fork/test_fork.py (100%) rename tests/core/pyspec/eth2spec/test/{lightclient_patch => altair}/sanity/__init__.py (100%) rename tests/core/pyspec/eth2spec/test/{lightclient_patch => altair}/sanity/test_blocks.py (100%) diff --git a/configs/mainnet/lightclient_patch.yaml b/configs/mainnet/altair.yaml similarity index 100% rename from configs/mainnet/lightclient_patch.yaml rename to configs/mainnet/altair.yaml diff --git a/configs/minimal/lightclient_patch.yaml b/configs/minimal/altair.yaml similarity index 100% rename from configs/minimal/lightclient_patch.yaml rename to configs/minimal/altair.yaml diff --git a/specs/lightclient/beacon-chain.md b/specs/altair/beacon-chain.md similarity index 100% rename from specs/lightclient/beacon-chain.md rename to specs/altair/beacon-chain.md diff --git a/specs/lightclient/fork.md b/specs/altair/fork.md similarity index 100% rename from specs/lightclient/fork.md rename to specs/altair/fork.md diff --git a/specs/lightclient/sync-protocol.md b/specs/altair/sync-protocol.md similarity index 100% rename from specs/lightclient/sync-protocol.md rename to specs/altair/sync-protocol.md diff --git a/tests/core/pyspec/eth2spec/test/lightclient_patch/__init__.py b/tests/core/pyspec/eth2spec/test/altair/__init__.py similarity index 100% rename from tests/core/pyspec/eth2spec/test/lightclient_patch/__init__.py rename to tests/core/pyspec/eth2spec/test/altair/__init__.py diff --git a/tests/core/pyspec/eth2spec/test/lightclient_patch/block_processing/__init__.py b/tests/core/pyspec/eth2spec/test/altair/block_processing/__init__.py similarity index 100% rename from tests/core/pyspec/eth2spec/test/lightclient_patch/block_processing/__init__.py rename to tests/core/pyspec/eth2spec/test/altair/block_processing/__init__.py diff --git a/tests/core/pyspec/eth2spec/test/lightclient_patch/block_processing/test_process_sync_committee.py b/tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py similarity index 100% rename from tests/core/pyspec/eth2spec/test/lightclient_patch/block_processing/test_process_sync_committee.py rename to tests/core/pyspec/eth2spec/test/altair/block_processing/test_process_sync_committee.py diff --git a/tests/core/pyspec/eth2spec/test/lightclient_patch/epoch_processing/__init__.py b/tests/core/pyspec/eth2spec/test/altair/epoch_processing/__init__.py similarity index 100% rename from tests/core/pyspec/eth2spec/test/lightclient_patch/epoch_processing/__init__.py rename to tests/core/pyspec/eth2spec/test/altair/epoch_processing/__init__.py diff --git a/tests/core/pyspec/eth2spec/test/lightclient_patch/epoch_processing/test_process_sync_committee_updates.py b/tests/core/pyspec/eth2spec/test/altair/epoch_processing/test_process_sync_committee_updates.py similarity index 100% rename from tests/core/pyspec/eth2spec/test/lightclient_patch/epoch_processing/test_process_sync_committee_updates.py rename to tests/core/pyspec/eth2spec/test/altair/epoch_processing/test_process_sync_committee_updates.py diff --git a/tests/core/pyspec/eth2spec/test/lightclient_patch/fork/__init__.py b/tests/core/pyspec/eth2spec/test/altair/fork/__init__.py similarity index 100% rename from tests/core/pyspec/eth2spec/test/lightclient_patch/fork/__init__.py rename to tests/core/pyspec/eth2spec/test/altair/fork/__init__.py diff --git a/tests/core/pyspec/eth2spec/test/lightclient_patch/fork/test_fork.py b/tests/core/pyspec/eth2spec/test/altair/fork/test_fork.py similarity index 100% rename from tests/core/pyspec/eth2spec/test/lightclient_patch/fork/test_fork.py rename to tests/core/pyspec/eth2spec/test/altair/fork/test_fork.py diff --git a/tests/core/pyspec/eth2spec/test/lightclient_patch/sanity/__init__.py b/tests/core/pyspec/eth2spec/test/altair/sanity/__init__.py similarity index 100% rename from tests/core/pyspec/eth2spec/test/lightclient_patch/sanity/__init__.py rename to tests/core/pyspec/eth2spec/test/altair/sanity/__init__.py diff --git a/tests/core/pyspec/eth2spec/test/lightclient_patch/sanity/test_blocks.py b/tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py similarity index 100% rename from tests/core/pyspec/eth2spec/test/lightclient_patch/sanity/test_blocks.py rename to tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py From b44e576e95a4f80b30ae04c721d6b97333af1159 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 11 Mar 2021 21:22:38 +0800 Subject: [PATCH 09/10] LIGHTCLIENT_PATCH/HF1 -> ALTAIR --- .gitignore | 2 +- Makefile | 10 ++-- README.md | 7 +-- configs/mainnet/altair.yaml | 8 +-- configs/minimal/altair.yaml | 8 +-- setup.py | 12 ++--- specs/altair/beacon-chain.md | 38 +++++++------- specs/altair/fork.md | 12 ++--- .../eth2spec/test/altair/fork/test_fork.py | 50 +++++++++---------- tests/core/pyspec/eth2spec/test/context.py | 30 +++++------ .../eth2spec/test/helpers/attestations.py | 8 +-- .../pyspec/eth2spec/test/helpers/block.py | 4 +- .../eth2spec/test/helpers/epoch_processing.py | 6 +-- .../test/helpers/proposer_slashings.py | 6 +-- .../pyspec/eth2spec/test/helpers/rewards.py | 26 +++++----- ..._process_justification_and_finalization.py | 6 +-- .../test_process_rewards_and_penalties.py | 12 ++--- .../test_process_slashings.py | 6 +-- .../test/phase0/sanity/test_blocks.py | 8 +-- .../fork_choice/test_on_attestation.py | 4 +- .../test_process_attestation.py | 6 +-- .../test_process_chunk_challenge.py | 24 ++++----- .../test_process_custody_key_reveal.py | 12 ++--- .../test_process_custody_slashing.py | 12 ++--- ...est_process_early_derived_secret_reveal.py | 18 +++---- .../test_process_shard_transition.py | 10 ++-- .../test_process_challenge_deadlines.py | 4 +- .../test_process_custody_final_updates.py | 10 ++-- .../test_process_reveal_deadlines.py | 6 +-- .../test/phase1/sanity/test_blocks.py | 14 +++--- .../test/phase1/sanity/test_shard_blocks.py | 24 ++++----- .../fork_choice/test_on_shard_block.py | 8 +-- .../phase1/unittests/test_get_start_shard.py | 12 ++--- tests/formats/forks/README.md | 2 +- tests/generators/README.md | 10 ++-- tests/generators/epoch_processing/main.py | 12 ++--- tests/generators/finality/main.py | 12 ++--- tests/generators/forks/main.py | 12 ++--- tests/generators/operations/main.py | 12 ++--- tests/generators/rewards/main.py | 12 ++--- tests/generators/sanity/main.py | 10 ++-- tests/generators/ssz_static/main.py | 10 ++-- 42 files changed, 258 insertions(+), 257 deletions(-) diff --git a/.gitignore b/.gitignore index 17d058225..56a3d605c 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ eth2.0-spec-tests/ # Dynamically built from Markdown spec tests/core/pyspec/eth2spec/phase0/ tests/core/pyspec/eth2spec/phase1/ -tests/core/pyspec/eth2spec/lightclient_patch/ +tests/core/pyspec/eth2spec/altair/ # coverage reports .htmlcov diff --git a/Makefile b/Makefile index 08e822bf6..97da705ef 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ GENERATOR_VENVS = $(patsubst $(GENERATOR_DIR)/%, $(GENERATOR_DIR)/%venv, $(GENER # To check generator matching: #$(info $$GENERATOR_TARGETS is [${GENERATOR_TARGETS}]) -MARKDOWN_FILES = $(wildcard $(SPEC_DIR)/phase0/*.md) $(wildcard $(SPEC_DIR)/phase1/*.md) $(wildcard $(SPEC_DIR)/lightclient/*.md) $(wildcard $(SSZ_DIR)/*.md) $(wildcard $(SPEC_DIR)/networking/*.md) $(wildcard $(SPEC_DIR)/validator/*.md) +MARKDOWN_FILES = $(wildcard $(SPEC_DIR)/phase0/*.md) $(wildcard $(SPEC_DIR)/phase1/*.md) $(wildcard $(SPEC_DIR)/altair/*.md) $(wildcard $(SSZ_DIR)/*.md) $(wildcard $(SPEC_DIR)/networking/*.md) $(wildcard $(SPEC_DIR)/validator/*.md) COV_HTML_OUT=.htmlcov COV_INDEX_FILE=$(PY_SPEC_DIR)/$(COV_HTML_OUT)/index.html @@ -49,7 +49,7 @@ partial_clean: rm -rf $(DEPOSIT_CONTRACT_TESTER_DIR)/.pytest_cache rm -rf $(PY_SPEC_DIR)/phase0 rm -rf $(PY_SPEC_DIR)/phase1 - rm -rf $(PY_SPEC_DIR)/lightclient + rm -rf $(PY_SPEC_DIR)/altair rm -rf $(PY_SPEC_DIR)/$(COV_HTML_OUT) rm -rf $(PY_SPEC_DIR)/.coverage rm -rf $(PY_SPEC_DIR)/test-reports @@ -86,11 +86,11 @@ install_test: test: pyspec . venv/bin/activate; cd $(PY_SPEC_DIR); \ - python3 -m pytest -n 4 --disable-bls --cov=eth2spec.phase0.spec --cov=eth2spec.phase1.spec --cov=eth2spec.lightclient_patch.spec -cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec + python3 -m pytest -n 4 --disable-bls --cov=eth2spec.phase0.spec --cov=eth2spec.phase1.spec --cov=eth2spec.altair.spec -cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec find_test: pyspec . venv/bin/activate; cd $(PY_SPEC_DIR); \ - python3 -m pytest -k=$(K) --disable-bls --cov=eth2spec.phase0.spec --cov=eth2spec.phase1.spec --cov=eth2spec.lightclient_patch.spec --cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec + python3 -m pytest -k=$(K) --disable-bls --cov=eth2spec.phase0.spec --cov=eth2spec.phase1.spec --cov=eth2spec.altair.spec --cov-report="html:$(COV_HTML_OUT)" --cov-branch eth2spec citest: pyspec mkdir -p tests/core/pyspec/test-reports/eth2spec; . venv/bin/activate; cd $(PY_SPEC_DIR); \ @@ -113,7 +113,7 @@ codespell: lint: pyspec . venv/bin/activate; cd $(PY_SPEC_DIR); \ flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \ - && mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.phase1 -p eth2spec.lightclient_patch + && mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.phase1 -p eth2spec.altair lint_generators: pyspec . venv/bin/activate; cd $(TEST_GENERATORS_DIR); \ diff --git a/README.md b/README.md index 937841127..42ad7e71f 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,11 @@ Core specifications for Eth2 clients be found in [specs](specs/). These are divi * [Honest Validator](specs/phase0/validator.md) * [P2P Networking](specs/phase0/p2p-interface.md) -### Light clients +### Altair -* [Beacon chain changes](specs/lightclient/beacon-chain.md) -* [Light client sync protocol](specs/lightclient/sync-protocol.md) +* [Beacon chain changes](specs/altair/beacon-chain.md) +* [Altair fork](specs/altair/fork.md) +* [Light client sync protocol](specs/altair/sync-protocol.md) ### Sharding diff --git a/configs/mainnet/altair.yaml b/configs/mainnet/altair.yaml index a9ddc16f6..8ba51d283 100644 --- a/configs/mainnet/altair.yaml +++ b/configs/mainnet/altair.yaml @@ -1,15 +1,15 @@ -# Mainnet preset - lightclient patch +# Mainnet preset - Altair CONFIG_NAME: "mainnet" # Updated penalty values # --------------------------------------------------------------- # 3 * 2**24) (= 50,331,648) -HF1_INACTIVITY_PENALTY_QUOTIENT: 50331648 +ALTAIR_INACTIVITY_PENALTY_QUOTIENT: 50331648 # 2**6 (= 64) -HF1_MIN_SLASHING_PENALTY_QUOTIENT: 64 +ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT: 64 # 2 -HF1_PROPORTIONAL_SLASHING_MULTIPLIER: 2 +ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER: 2 # Misc diff --git a/configs/minimal/altair.yaml b/configs/minimal/altair.yaml index 56ce34591..38cf4db76 100644 --- a/configs/minimal/altair.yaml +++ b/configs/minimal/altair.yaml @@ -1,15 +1,15 @@ -# Minimal preset - lightclient patch +# Minimal preset - Altair CONFIG_NAME: "minimal" # Updated penalty values # --------------------------------------------------------------- # 3 * 2**24) (= 50,331,648) -HF1_INACTIVITY_PENALTY_QUOTIENT: 50331648 +ALTAIR_INACTIVITY_PENALTY_QUOTIENT: 50331648 # 2**6 (= 64) -HF1_MIN_SLASHING_PENALTY_QUOTIENT: 64 +ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT: 64 # 2 -HF1_PROPORTIONAL_SLASHING_MULTIPLIER: 2 +ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER: 2 # Misc diff --git a/setup.py b/setup.py index aa74fcb05..d0a2371e8 100644 --- a/setup.py +++ b/setup.py @@ -179,7 +179,7 @@ from eth2spec.utils import bls from eth2spec.utils.hash_function import hash -# Whenever lightclient is loaded, make sure we have the latest phase0 +# Whenever altair is loaded, make sure we have the latest phase0 from importlib import reload reload(phase0) @@ -386,7 +386,7 @@ def combine_spec_objects(spec0: SpecObject, spec1: SpecObject) -> SpecObject: fork_imports = { 'phase0': PHASE0_IMPORTS, 'phase1': PHASE1_IMPORTS, - 'lightclient_patch': LIGHTCLIENT_IMPORT, + 'altair': LIGHTCLIENT_IMPORT, } @@ -453,16 +453,16 @@ class PySpecCommand(Command): specs/phase1/shard-fork-choice.md specs/phase1/validator.md """ - elif self.spec_fork == "lightclient_patch": + elif self.spec_fork == "altair": self.md_doc_paths = """ specs/phase0/beacon-chain.md specs/phase0/fork-choice.md specs/phase0/validator.md specs/phase0/weak-subjectivity.md - specs/lightclient/beacon-chain.md - specs/lightclient/fork.md + specs/altair/beacon-chain.md + specs/altair/fork.md """ - # TODO: add specs/lightclient/sync-protocol.md back when the GeneralizedIndex helpers are included. + # TODO: add specs/altair/sync-protocol.md back when the GeneralizedIndex helpers are included. else: raise Exception('no markdown files specified, and spec fork "%s" is unknown', self.spec_fork) diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index bc070908a..d2e060cdf 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -1,4 +1,4 @@ -# Ethereum 2.0 HF1 +# Ethereum 2.0 Altair ## Table of contents @@ -55,7 +55,7 @@ ## Introduction -This is a patch implementing the first hard fork to the beacon chain, tentatively named HF1 pending a permanent name. +Altair is a patch implementing the first hard fork to the beacon chain. It has four main features: * Light client support via sync committees @@ -108,9 +108,9 @@ This patch updates a few configuration values to move penalty constants toward t | Name | Value | | - | - | -| `HF1_INACTIVITY_PENALTY_QUOTIENT` | `uint64(3 * 2**24)` (= 50,331,648) | -| `HF1_MIN_SLASHING_PENALTY_QUOTIENT` | `uint64(2**6)` (=64) | -| `HF1_PROPORTIONAL_SLASHING_MULTIPLIER` | `uint64(2)` | +| `ALTAIR_INACTIVITY_PENALTY_QUOTIENT` | `uint64(3 * 2**24)` (= 50,331,648) | +| `ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT` | `uint64(2**6)` (=64) | +| `ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER` | `uint64(2)` | ### Misc @@ -152,8 +152,8 @@ class BeaconBlockBody(Container): deposits: List[Deposit, MAX_DEPOSITS] voluntary_exits: List[SignedVoluntaryExit, MAX_VOLUNTARY_EXITS] # Sync committee aggregate signature - sync_committee_bits: Bitvector[SYNC_COMMITTEE_SIZE] # [New in HF1] - sync_committee_signature: BLSSignature # [New in HF1] + sync_committee_bits: Bitvector[SYNC_COMMITTEE_SIZE] # [New in Altair] + sync_committee_signature: BLSSignature # [New in Altair] ``` #### `BeaconState` @@ -379,7 +379,7 @@ def get_inactivity_penalty_deltas(state: BeaconState) -> Tuple[Sequence[Gwei], S effective_balance = state.validators[index].effective_balance penalties[index] += Gwei( effective_balance * get_finality_delay(state) - // HF1_INACTIVITY_PENALTY_QUOTIENT + // ALTAIR_INACTIVITY_PENALTY_QUOTIENT ) rewards = [Gwei(0) for _ in range(len(state.validators))] @@ -391,7 +391,7 @@ def get_inactivity_penalty_deltas(state: BeaconState) -> Tuple[Sequence[Gwei], S #### New `slash_validator` *Note*: The function `slash_validator` is modified -with the substitution of `MIN_SLASHING_PENALTY_QUOTIENT` with `HF1_MIN_SLASHING_PENALTY_QUOTIENT`. +with the substitution of `MIN_SLASHING_PENALTY_QUOTIENT` with `ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT`. ```python def slash_validator(state: BeaconState, @@ -406,7 +406,7 @@ def slash_validator(state: BeaconState, validator.slashed = True validator.withdrawable_epoch = max(validator.withdrawable_epoch, Epoch(epoch + EPOCHS_PER_SLASHINGS_VECTOR)) state.slashings[epoch % EPOCHS_PER_SLASHINGS_VECTOR] += validator.effective_balance - decrease_balance(state, slashed_index, validator.effective_balance // HF1_MIN_SLASHING_PENALTY_QUOTIENT) + decrease_balance(state, slashed_index, validator.effective_balance // ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT) # Apply proposer and whistleblower rewards proposer_index = get_beacon_proposer_index(state) @@ -425,8 +425,8 @@ def process_block(state: BeaconState, block: BeaconBlock) -> None: process_block_header(state, block) process_randao(state, block.body) process_eth1_data(state, block.body) - process_operations(state, block.body) # [Modified in HF1] - process_sync_committee(state, block.body) # [New in HF1] + process_operations(state, block.body) # [Modified in Altair] + process_sync_committee(state, block.body) # [New in Altair] ``` #### Modified `process_attestation` @@ -561,17 +561,17 @@ def process_sync_committee(state: BeaconState, body: BeaconBlockBody) -> None: ```python def process_epoch(state: BeaconState) -> None: - process_justification_and_finalization(state) # [Modified in HF1] - process_rewards_and_penalties(state) # [Modified in HF1] + process_justification_and_finalization(state) # [Modified in Altair] + process_rewards_and_penalties(state) # [Modified in Altair] process_registry_updates(state) - process_slashings(state) # [Modified in HF1] + process_slashings(state) # [Modified in Altair] process_eth1_data_reset(state) process_effective_balance_updates(state) process_slashings_reset(state) process_randao_mixes_reset(state) process_historical_roots_update(state) - process_participation_flag_updates(state) # [New in HF1] - process_sync_committee_updates(state) # [New in HF1] + process_participation_flag_updates(state) # [New in Altair] + process_sync_committee_updates(state) # [New in Altair] ``` #### Justification and finalization @@ -642,13 +642,13 @@ def process_rewards_and_penalties(state: BeaconState) -> None: #### Slashings -*Note*: The function `process_slashings` is modified to use `HF1_PROPORTIONAL_SLASHING_MULTIPLIER`. +*Note*: The function `process_slashings` is modified to use `ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER`. ```python def process_slashings(state: BeaconState) -> None: epoch = get_current_epoch(state) total_balance = get_total_active_balance(state) - adjusted_total_slashing_balance = min(sum(state.slashings) * HF1_PROPORTIONAL_SLASHING_MULTIPLIER, total_balance) + adjusted_total_slashing_balance = min(sum(state.slashings) * ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER, total_balance) for index, validator in enumerate(state.validators): if validator.slashed and epoch + EPOCHS_PER_SLASHINGS_VECTOR // 2 == validator.withdrawable_epoch: increment = EFFECTIVE_BALANCE_INCREMENT # Factored out from penalty numerator to avoid uint64 overflow diff --git a/specs/altair/fork.md b/specs/altair/fork.md index 157e67dc9..4972983af 100644 --- a/specs/altair/fork.md +++ b/specs/altair/fork.md @@ -25,21 +25,21 @@ Warning: this configuration is not definitive. | Name | Value | | - | - | -| `LIGHTCLIENT_PATCH_FORK_VERSION` | `Version('0x01000000')` | -| `LIGHTCLIENT_PATCH_FORK_SLOT` | `Slot(0)` **TBD** | +| `ALTAIR_FORK_VERSION` | `Version('0x01000000')` | +| `ALTAIR_FORK_SLOT` | `Slot(0)` **TBD** | ## Fork to Light-client patch ### Fork trigger -TBD. Social consensus, along with state conditions such as epoch boundary, finality, deposits, active validator count, etc. may be part of the decision process to trigger the fork. For now we assume the condition will be triggered at slot `LIGHTCLIENT_PATCH_FORK_SLOT`, where `LIGHTCLIENT_PATCH_FORK_SLOT % SLOTS_PER_EPOCH == 0`. +TBD. Social consensus, along with state conditions such as epoch boundary, finality, deposits, active validator count, etc. may be part of the decision process to trigger the fork. For now we assume the condition will be triggered at slot `ALTAIR_FORK_SLOT`, where `ALTAIR_FORK_SLOT % SLOTS_PER_EPOCH == 0`. ### Upgrading the state -After `process_slots` of Phase 0 finishes, if `state.slot == LIGHTCLIENT_PATCH_FORK_SLOT`, an irregular state change is made to upgrade to light-client patch. +After `process_slots` of Phase 0 finishes, if `state.slot == ALTAIR_FORK_SLOT`, an irregular state change is made to upgrade to light-client patch. ```python -def upgrade_to_lightclient_patch(pre: phase0.BeaconState) -> BeaconState: +def upgrade_to_altair(pre: phase0.BeaconState) -> BeaconState: epoch = get_current_epoch(pre) post = BeaconState( genesis_time=pre.genesis_time, @@ -47,7 +47,7 @@ def upgrade_to_lightclient_patch(pre: phase0.BeaconState) -> BeaconState: slot=pre.slot, fork=Fork( previous_version=pre.fork.current_version, - current_version=LIGHTCLIENT_PATCH_FORK_VERSION, + current_version=ALTAIR_FORK_VERSION, epoch=epoch, ), # History diff --git a/tests/core/pyspec/eth2spec/test/altair/fork/test_fork.py b/tests/core/pyspec/eth2spec/test/altair/fork/test_fork.py index 27d181510..9667c2e37 100644 --- a/tests/core/pyspec/eth2spec/test/altair/fork/test_fork.py +++ b/tests/core/pyspec/eth2spec/test/altair/fork/test_fork.py @@ -1,5 +1,5 @@ from eth2spec.test.context import ( - PHASE0, LIGHTCLIENT_PATCH, + PHASE0, ALTAIR, with_phases, with_custom_state, spec_test, with_state, @@ -12,7 +12,7 @@ from eth2spec.test.helpers.state import ( ) -HF1_FORK_TEST_META_TAGS = { +ALTAIR_FORK_TEST_META_TAGS = { 'fork': 'altair', } @@ -20,7 +20,7 @@ HF1_FORK_TEST_META_TAGS = { def run_fork_test(post_spec, pre_state): yield 'pre', pre_state - post_state = post_spec.upgrade_to_lightclient_patch(pre_state) + post_state = post_spec.upgrade_to_altair(pre_state) # Stable fields stable_fields = [ @@ -47,67 +47,67 @@ def run_fork_test(post_spec, pre_state): assert getattr(pre_state, field) != getattr(post_state, field) assert pre_state.fork.current_version == post_state.fork.previous_version - assert post_state.fork.current_version == post_spec.LIGHTCLIENT_PATCH_FORK_VERSION + assert post_state.fork.current_version == post_spec.ALTAIR_FORK_VERSION assert post_state.fork.epoch == post_spec.get_current_epoch(post_state) yield 'post', post_state -@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH]) +@with_phases(phases=[PHASE0], other_phases=[ALTAIR]) @spec_test @with_state -@with_meta_tags(HF1_FORK_TEST_META_TAGS) +@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS) def test_fork_base_state(spec, phases, state): - yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state) + yield from run_fork_test(phases[ALTAIR], state) -@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH]) +@with_phases(phases=[PHASE0], other_phases=[ALTAIR]) @spec_test @with_state -@with_meta_tags(HF1_FORK_TEST_META_TAGS) +@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS) def test_fork_next_epoch(spec, phases, state): next_epoch(spec, state) - yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state) + yield from run_fork_test(phases[ALTAIR], state) -@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH]) +@with_phases(phases=[PHASE0], other_phases=[ALTAIR]) @spec_test @with_state -@with_meta_tags(HF1_FORK_TEST_META_TAGS) +@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS) def test_fork_next_epoch_with_block(spec, phases, state): next_epoch_via_block(spec, state) - yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state) + yield from run_fork_test(phases[ALTAIR], state) -@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH]) +@with_phases(phases=[PHASE0], other_phases=[ALTAIR]) @spec_test @with_state -@with_meta_tags(HF1_FORK_TEST_META_TAGS) +@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS) def test_fork_many_next_epoch(spec, phases, state): for _ in range(3): next_epoch(spec, state) - yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state) + yield from run_fork_test(phases[ALTAIR], state) -@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH]) +@with_phases(phases=[PHASE0], other_phases=[ALTAIR]) @with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE) @spec_test -@with_meta_tags(HF1_FORK_TEST_META_TAGS) +@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS) def test_fork_random_low_balances(spec, phases, state): - yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state) + yield from run_fork_test(phases[ALTAIR], state) -@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH]) +@with_phases(phases=[PHASE0], other_phases=[ALTAIR]) @with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE) @spec_test -@with_meta_tags(HF1_FORK_TEST_META_TAGS) +@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS) def test_fork_random_misc_balances(spec, phases, state): - yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state) + yield from run_fork_test(phases[ALTAIR], state) -@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH]) +@with_phases(phases=[PHASE0], other_phases=[ALTAIR]) @with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.EJECTION_BALANCE) @spec_test -@with_meta_tags(HF1_FORK_TEST_META_TAGS) +@with_meta_tags(ALTAIR_FORK_TEST_META_TAGS) def test_fork_random_large_validator_set(spec, phases, state): - yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state) + yield from run_fork_test(phases[ALTAIR], state) diff --git a/tests/core/pyspec/eth2spec/test/context.py b/tests/core/pyspec/eth2spec/test/context.py index e197124c0..d631bb4d2 100644 --- a/tests/core/pyspec/eth2spec/test/context.py +++ b/tests/core/pyspec/eth2spec/test/context.py @@ -2,7 +2,7 @@ import pytest from eth2spec.phase0 import spec as spec_phase0 from eth2spec.phase1 import spec as spec_phase1 -from eth2spec.lightclient_patch import spec as spec_lightclient_patch +from eth2spec.altair import spec as spec_altair from eth2spec.utils import bls from .exceptions import SkippedTest @@ -20,7 +20,7 @@ from importlib import reload def reload_specs(): reload(spec_phase0) reload(spec_phase1) - reload(spec_lightclient_patch) + reload(spec_altair) # Some of the Spec module functionality is exposed here to deal with phase-specific changes. @@ -30,9 +30,9 @@ ConfigName = NewType("ConfigName", str) PHASE0 = SpecForkName('phase0') PHASE1 = SpecForkName('phase1') -LIGHTCLIENT_PATCH = SpecForkName('lightclient_patch') +ALTAIR = SpecForkName('altair') -ALL_PHASES = (PHASE0, PHASE1, LIGHTCLIENT_PATCH) +ALL_PHASES = (PHASE0, PHASE1, ALTAIR) MAINNET = ConfigName('mainnet') MINIMAL = ConfigName('minimal') @@ -40,7 +40,7 @@ MINIMAL = ConfigName('minimal') ALL_CONFIGS = (MINIMAL, MAINNET) # The forks that output to the test vectors. -TESTGEN_FORKS = (PHASE0, LIGHTCLIENT_PATCH) +TESTGEN_FORKS = (PHASE0, ALTAIR) # TODO: currently phases are defined as python modules. # It would be better if they would be more well-defined interfaces for stronger typing. @@ -66,7 +66,7 @@ class SpecLightclient(Spec): class SpecForks(TypedDict, total=False): PHASE0: SpecPhase0 PHASE1: SpecPhase1 - LIGHTCLIENT_PATCH: SpecLightclient + ALTAIR: SpecLightclient def _prepare_state(balances_fn: Callable[[Any], Sequence[int]], threshold_fn: Callable[[Any], int], @@ -82,8 +82,8 @@ def _prepare_state(balances_fn: Callable[[Any], Sequence[int]], threshold_fn: Ca # TODO: instead of upgrading a test phase0 genesis state we can also write a phase1 state helper. # Decide based on performance/consistency results later. state = phases[PHASE1].upgrade_to_phase1(state) - elif spec.fork == LIGHTCLIENT_PATCH: - state = phases[LIGHTCLIENT_PATCH].upgrade_to_lightclient_patch(state) + elif spec.fork == ALTAIR: + state = phases[ALTAIR].upgrade_to_altair(state) return state @@ -352,16 +352,16 @@ def with_phases(phases, other_phases=None): phase_dir[PHASE0] = spec_phase0 if PHASE1 in available_phases: phase_dir[PHASE1] = spec_phase1 - if LIGHTCLIENT_PATCH in available_phases: - phase_dir[LIGHTCLIENT_PATCH] = spec_lightclient_patch + if ALTAIR in available_phases: + phase_dir[ALTAIR] = spec_altair # return is ignored whenever multiple phases are ran. If if PHASE0 in run_phases: ret = fn(spec=spec_phase0, phases=phase_dir, *args, **kw) if PHASE1 in run_phases: ret = fn(spec=spec_phase1, phases=phase_dir, *args, **kw) - if LIGHTCLIENT_PATCH in run_phases: - ret = fn(spec=spec_lightclient_patch, phases=phase_dir, *args, **kw) + if ALTAIR in run_phases: + ret = fn(spec=spec_altair, phases=phase_dir, *args, **kw) return ret return wrapper return decorator @@ -397,9 +397,9 @@ def only_full_crosslink(fn): return wrapper -def is_post_lightclient_patch(spec): +def is_post_altair(spec): if spec.fork in [PHASE0, PHASE1]: - # TODO: PHASE1 fork is temporarily parallel to LIGHTCLIENT_PATCH. - # Will make PHASE1 fork inherit LIGHTCLIENT_PATCH later. + # TODO: PHASE1 fork is temporarily parallel to ALTAIR. + # Will make PHASE1 fork inherit ALTAIR later. return False return True diff --git a/tests/core/pyspec/eth2spec/test/helpers/attestations.py b/tests/core/pyspec/eth2spec/test/helpers/attestations.py index 571e19fef..0b3e0484a 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/attestations.py +++ b/tests/core/pyspec/eth2spec/test/helpers/attestations.py @@ -2,7 +2,7 @@ from lru import LRU from typing import List -from eth2spec.test.context import expect_assertion_error, PHASE1, is_post_lightclient_patch +from eth2spec.test.context import expect_assertion_error, PHASE1, is_post_altair from eth2spec.test.helpers.state import state_transition_and_sign_block, next_epoch, next_slot from eth2spec.test.helpers.block import build_empty_block_for_next_slot from eth2spec.test.helpers.shard_transitions import get_shard_transition_of_committee @@ -30,7 +30,7 @@ def run_attestation_processing(spec, state, attestation, valid=True): yield 'post', None return - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): current_epoch_count = len(state.current_epoch_attestations) previous_epoch_count = len(state.previous_epoch_attestations) @@ -38,7 +38,7 @@ def run_attestation_processing(spec, state, attestation, valid=True): spec.process_attestation(state, attestation) # Make sure the attestation has been processed - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): if attestation.data.target.epoch == spec.get_current_epoch(state): assert len(state.current_epoch_attestations) == current_epoch_count + 1 else: @@ -320,7 +320,7 @@ def prepare_state_with_attestations(spec, state, participation_fn=None): next_slot(spec, state) assert state.slot == next_epoch_start_slot + spec.MIN_ATTESTATION_INCLUSION_DELAY - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): assert len(state.previous_epoch_attestations) == len(attestations) return attestations diff --git a/tests/core/pyspec/eth2spec/test/helpers/block.py b/tests/core/pyspec/eth2spec/test/helpers/block.py index 7501c8268..084826d65 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/block.py +++ b/tests/core/pyspec/eth2spec/test/helpers/block.py @@ -1,4 +1,4 @@ -from eth2spec.test.context import is_post_lightclient_patch +from eth2spec.test.context import is_post_altair from eth2spec.test.helpers.keys import privkeys from eth2spec.utils import bls from eth2spec.utils.bls import only_with_bls @@ -91,7 +91,7 @@ def build_empty_block(spec, state, slot=None): empty_block.body.eth1_data.deposit_count = state.eth1_deposit_index empty_block.parent_root = parent_block_root - if is_post_lightclient_patch(spec): + if is_post_altair(spec): empty_block.body.sync_committee_signature = spec.G2_POINT_AT_INFINITY apply_randao_reveal(spec, state, empty_block) diff --git a/tests/core/pyspec/eth2spec/test/helpers/epoch_processing.py b/tests/core/pyspec/eth2spec/test/helpers/epoch_processing.py index 52479cfeb..e8e3dd492 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/epoch_processing.py +++ b/tests/core/pyspec/eth2spec/test/helpers/epoch_processing.py @@ -1,5 +1,5 @@ -from eth2spec.test.context import is_post_lightclient_patch +from eth2spec.test.context import is_post_altair def get_process_calls(spec): @@ -16,8 +16,8 @@ def get_process_calls(spec): 'process_slashings_reset', 'process_randao_mixes_reset', 'process_historical_roots_update', - # HF1 replaced `process_participation_record_updates` with `process_participation_flag_updates` - 'process_participation_flag_updates' if is_post_lightclient_patch(spec) else ( + # Altair replaced `process_participation_record_updates` with `process_participation_flag_updates` + 'process_participation_flag_updates' if is_post_altair(spec) else ( 'process_participation_record_updates' ), 'process_sync_committee_updates', diff --git a/tests/core/pyspec/eth2spec/test/helpers/proposer_slashings.py b/tests/core/pyspec/eth2spec/test/helpers/proposer_slashings.py index 89acb3417..97d09b141 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/proposer_slashings.py +++ b/tests/core/pyspec/eth2spec/test/helpers/proposer_slashings.py @@ -1,12 +1,12 @@ -from eth2spec.test.context import is_post_lightclient_patch +from eth2spec.test.context import is_post_altair from eth2spec.test.helpers.block_header import sign_block_header from eth2spec.test.helpers.keys import pubkey_to_privkey from eth2spec.test.helpers.state import get_balance def get_min_slashing_penalty_quotient(spec): - if is_post_lightclient_patch(spec): - return spec.HF1_MIN_SLASHING_PENALTY_QUOTIENT + if is_post_altair(spec): + return spec.ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT else: return spec.MIN_SLASHING_PENALTY_QUOTIENT diff --git a/tests/core/pyspec/eth2spec/test/helpers/rewards.py b/tests/core/pyspec/eth2spec/test/helpers/rewards.py index 19ed3f691..4f8b5ea5e 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/rewards.py +++ b/tests/core/pyspec/eth2spec/test/helpers/rewards.py @@ -2,7 +2,7 @@ from random import Random from lru import LRU from eth2spec.phase0 import spec as spec_phase0 -from eth2spec.test.context import is_post_lightclient_patch +from eth2spec.test.context import is_post_altair from eth2spec.test.helpers.attestations import cached_prepare_state_with_attestations from eth2spec.test.helpers.deposits import mock_deposit from eth2spec.test.helpers.state import next_epoch @@ -39,7 +39,7 @@ def run_deltas(spec, state): """ yield 'pre', state - if is_post_lightclient_patch(spec): + if is_post_altair(spec): def get_source_deltas(state): return spec.get_flag_deltas(state, spec.TIMELY_SOURCE_FLAG_INDEX, spec.TIMELY_SOURCE_FLAG_NUMERATOR) @@ -52,21 +52,21 @@ def run_deltas(spec, state): yield from run_attestation_component_deltas( spec, state, - spec.get_source_deltas if not is_post_lightclient_patch(spec) else get_source_deltas, + spec.get_source_deltas if not is_post_altair(spec) else get_source_deltas, spec.get_matching_source_attestations, 'source_deltas', ) yield from run_attestation_component_deltas( spec, state, - spec.get_target_deltas if not is_post_lightclient_patch(spec) else get_target_deltas, + spec.get_target_deltas if not is_post_altair(spec) else get_target_deltas, spec.get_matching_target_attestations, 'target_deltas', ) yield from run_attestation_component_deltas( spec, state, - spec.get_head_deltas if not is_post_lightclient_patch(spec) else get_head_deltas, + spec.get_head_deltas if not is_post_altair(spec) else get_head_deltas, spec.get_matching_head_attestations, 'head_deltas', ) @@ -93,7 +93,7 @@ def run_attestation_component_deltas(spec, state, component_delta_fn, matching_a yield deltas_name, Deltas(rewards=rewards, penalties=penalties) - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): matching_attestations = matching_att_fn(state, spec.get_previous_epoch(state)) matching_indices = spec.get_unslashed_attesting_indices(state, matching_attestations) else: @@ -129,7 +129,7 @@ def run_get_inclusion_delay_deltas(spec, state): Run ``get_inclusion_delay_deltas``, yielding: - inclusion delay deltas ('inclusion_delay_deltas') """ - if is_post_lightclient_patch(spec): + if is_post_altair(spec): # No inclusion_delay_deltas yield 'inclusion_delay_deltas', Deltas(rewards=[0] * len(state.validators), penalties=[0] * len(state.validators)) @@ -182,7 +182,7 @@ def run_get_inactivity_penalty_deltas(spec, state): yield 'inactivity_penalty_deltas', Deltas(rewards=rewards, penalties=penalties) - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): matching_attestations = spec.get_matching_target_attestations(state, spec.get_previous_epoch(state)) matching_attesting_indices = spec.get_unslashed_attesting_indices(state, matching_attestations) else: @@ -200,7 +200,7 @@ def run_get_inactivity_penalty_deltas(spec, state): if spec.is_in_inactivity_leak(state): # Compute base_penalty - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): cancel_base_rewards_per_epoch = spec.BASE_REWARDS_PER_EPOCH base_reward = spec.get_base_reward(state, index) base_penalty = cancel_base_rewards_per_epoch * base_reward - spec.get_proposer_reward(state, index) @@ -308,7 +308,7 @@ def run_test_full_all_correct(spec, state): def run_test_full_but_partial_participation(spec, state, rng=Random(5522)): cached_prepare_state_with_attestations(spec, state) - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): for a in state.previous_epoch_attestations: a.aggregation_bits = [rng.choice([True, False]) for _ in a.aggregation_bits] else: @@ -323,7 +323,7 @@ def run_test_partial(spec, state, fraction_filled): cached_prepare_state_with_attestations(spec, state) # Remove portion of attestations - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): num_attestations = int(len(state.previous_epoch_attestations) * fraction_filled) state.previous_epoch_attestations = state.previous_epoch_attestations[:num_attestations] else: @@ -383,7 +383,7 @@ def run_test_some_very_low_effective_balances_that_attested(spec, state): def run_test_some_very_low_effective_balances_that_did_not_attest(spec, state): cached_prepare_state_with_attestations(spec, state) - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): # Remove attestation attestation = state.previous_epoch_attestations[0] state.previous_epoch_attestations = state.previous_epoch_attestations[1:] @@ -502,7 +502,7 @@ def run_test_full_random(spec, state, rng=Random(8020)): cached_prepare_state_with_attestations(spec, state) - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): for pending_attestation in state.previous_epoch_attestations: # ~1/3 have bad target if rng.randint(0, 2) == 0: diff --git a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_justification_and_finalization.py b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_justification_and_finalization.py index 274d67134..9db6076f8 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_justification_and_finalization.py +++ b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_justification_and_finalization.py @@ -1,4 +1,4 @@ -from eth2spec.test.context import is_post_lightclient_patch, spec_state_test, with_all_phases +from eth2spec.test.context import is_post_altair, spec_state_test, with_all_phases from eth2spec.test.helpers.epoch_processing import ( run_epoch_processing_with, ) @@ -16,7 +16,7 @@ def add_mock_attestations(spec, state, epoch, source, target, sufficient_support previous_epoch = spec.get_previous_epoch(state) current_epoch = spec.get_current_epoch(state) - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): if current_epoch == epoch: attestations = state.current_epoch_attestations elif previous_epoch == epoch: @@ -61,7 +61,7 @@ def add_mock_attestations(spec, state, epoch, source, target, sufficient_support aggregation_bits[i] = 0 # Update state - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): attestations.append(spec.PendingAttestation( aggregation_bits=aggregation_bits, data=spec.AttestationData( diff --git a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_rewards_and_penalties.py b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_rewards_and_penalties.py index 7bb86b45e..229dafe53 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_rewards_and_penalties.py +++ b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_rewards_and_penalties.py @@ -5,7 +5,7 @@ from eth2spec.test.context import ( with_custom_state, zero_activation_threshold, misc_balances, low_single_balance, - is_post_lightclient_patch, + is_post_altair, ) from eth2spec.test.helpers.state import ( next_epoch, @@ -161,7 +161,7 @@ def run_with_participation(spec, state, participation_fn): attestations = prepare_state_with_attestations(spec, state, participation_fn=participation_tracker) pre_state = state.copy() - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): proposer_indices = [a.proposer_index for a in state.previous_epoch_attestations] else: sync_committee_indices = spec.get_sync_committee_indices(state, spec.get_current_epoch(state)) @@ -173,11 +173,11 @@ def run_with_participation(spec, state, participation_fn): for index in range(len(pre_state.validators)): if spec.is_in_inactivity_leak(state): - # Proposers can still make money during a leak before LIGHTCLIENT_PATCH - if not is_post_lightclient_patch(spec) and index in proposer_indices and index in participated: + # Proposers can still make money during a leak before ALTAIR + if not is_post_altair(spec) and index in proposer_indices and index in participated: assert state.balances[index] > pre_state.balances[index] elif index in attesting_indices: - if is_post_lightclient_patch(spec) and index in sync_committee_indices: + if is_post_altair(spec) and index in sync_committee_indices: # The sync committee reward has not been canceled, so the sync committee participants still earn it assert state.balances[index] >= pre_state.balances[index] else: @@ -428,7 +428,7 @@ def test_attestations_some_slashed(spec, state): for i in range(spec.MIN_PER_EPOCH_CHURN_LIMIT): spec.slash_validator(state, attesting_indices_before_slashings[i]) - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): assert len(state.previous_epoch_attestations) == len(attestations) pre_state = state.copy() diff --git a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py index 34f1e89c6..b31f6fb81 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py +++ b/tests/core/pyspec/eth2spec/test/phase0/epoch_processing/test_process_slashings.py @@ -1,4 +1,4 @@ -from eth2spec.test.context import spec_state_test, with_all_phases, is_post_lightclient_patch +from eth2spec.test.context import spec_state_test, with_all_phases, is_post_altair from eth2spec.test.helpers.epoch_processing import ( run_epoch_processing_with, run_epoch_processing_to ) @@ -24,8 +24,8 @@ def slash_validators(spec, state, indices, out_epochs): def get_slashing_multiplier(spec): - if is_post_lightclient_patch(spec): - return spec.HF1_PROPORTIONAL_SLASHING_MULTIPLIER + if is_post_altair(spec): + return spec.ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER else: return spec.PROPORTIONAL_SLASHING_MULTIPLIER diff --git a/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py b/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py index 98ffbd590..8af0411c4 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py @@ -35,7 +35,7 @@ from eth2spec.test.context import ( with_configs, with_custom_state, large_validator_set, - is_post_lightclient_patch, + is_post_altair, ) @@ -781,14 +781,14 @@ def test_attestation(spec, state): spec, state, shard_transition=shard_transition, index=index, signed=True, on_time=True ) - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): pre_current_attestations_len = len(state.current_epoch_attestations) # Add to state via block transition attestation_block.body.attestations.append(attestation) signed_attestation_block = state_transition_and_sign_block(spec, state, attestation_block) - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): assert len(state.current_epoch_attestations) == pre_current_attestations_len + 1 # Epoch transition should move to previous_epoch_attestations pre_current_attestations_root = spec.hash_tree_root(state.current_epoch_attestations) @@ -801,7 +801,7 @@ def test_attestation(spec, state): yield 'blocks', [signed_attestation_block, signed_epoch_block] yield 'post', state - if not is_post_lightclient_patch(spec): + if not is_post_altair(spec): assert len(state.current_epoch_attestations) == 0 assert spec.hash_tree_root(state.previous_epoch_attestations) == pre_current_attestations_root else: diff --git a/tests/core/pyspec/eth2spec/test/phase0/unittests/fork_choice/test_on_attestation.py b/tests/core/pyspec/eth2spec/test/phase0/unittests/fork_choice/test_on_attestation.py index 05f0fb051..926ebec80 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/unittests/fork_choice/test_on_attestation.py +++ b/tests/core/pyspec/eth2spec/test/phase0/unittests/fork_choice/test_on_attestation.py @@ -1,4 +1,4 @@ -from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH, with_all_phases, spec_state_test +from eth2spec.test.context import PHASE0, PHASE1, ALTAIR, with_all_phases, spec_state_test from eth2spec.test.helpers.block import build_empty_block_for_next_slot from eth2spec.test.helpers.attestations import get_valid_attestation, sign_attestation from eth2spec.test.helpers.state import transition_to, state_transition_and_sign_block, next_epoch, next_slot @@ -18,7 +18,7 @@ def run_on_attestation(spec, state, store, attestation, valid=True): spec.on_attestation(store, attestation) sample_index = indexed_attestation.attesting_indices[0] - if spec.fork in (PHASE0, LIGHTCLIENT_PATCH): + if spec.fork in (PHASE0, ALTAIR): latest_message = spec.LatestMessage( epoch=attestation.data.target.epoch, root=attestation.data.beacon_block_root, diff --git a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_attestation.py b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_attestation.py index 5b2f952ae..2f641eacb 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_attestation.py +++ b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_attestation.py @@ -1,6 +1,6 @@ from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, with_all_phases_except, spec_state_test, always_bls, @@ -13,7 +13,7 @@ from eth2spec.test.helpers.attestations import ( ) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls def test_on_time_success(spec, state): @@ -24,7 +24,7 @@ def test_on_time_success(spec, state): yield from run_attestation_processing(spec, state, attestation) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls def test_late_success(spec, state): diff --git a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_chunk_challenge.py b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_chunk_challenge.py index 27829e4a0..249074999 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_chunk_challenge.py +++ b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_chunk_challenge.py @@ -9,7 +9,7 @@ from eth2spec.test.helpers.attestations import ( from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, MINIMAL, expect_assertion_error, disable_process_reveal_deadlines, @@ -69,7 +69,7 @@ def run_custody_chunk_response_processing(spec, state, custody_response, valid=T yield 'post', state -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @with_configs([MINIMAL], reason="too slow") @disable_process_reveal_deadlines @@ -93,7 +93,7 @@ def test_challenge_appended(spec, state): yield from run_chunk_challenge_processing(spec, state, challenge) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -119,7 +119,7 @@ def test_challenge_empty_element_replaced(spec, state): yield from run_chunk_challenge_processing(spec, state, challenge) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -145,7 +145,7 @@ def test_duplicate_challenge(spec, state): yield from run_chunk_challenge_processing(spec, state, challenge, valid=False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -173,7 +173,7 @@ def test_second_challenge(spec, state): yield from run_chunk_challenge_processing(spec, state, challenge1) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -198,7 +198,7 @@ def test_multiple_epochs_custody(spec, state): yield from run_chunk_challenge_processing(spec, state, challenge) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -223,7 +223,7 @@ def test_many_epochs_custody(spec, state): yield from run_chunk_challenge_processing(spec, state, challenge) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -244,7 +244,7 @@ def test_off_chain_attestation(spec, state): yield from run_chunk_challenge_processing(spec, state, challenge) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -276,7 +276,7 @@ def test_custody_response(spec, state): yield from run_custody_chunk_response_processing(spec, state, custody_response) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -307,7 +307,7 @@ def test_custody_response_chunk_index_2(spec, state): yield from run_custody_chunk_response_processing(spec, state, custody_response) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -339,7 +339,7 @@ def test_custody_response_multiple_epochs(spec, state): yield from run_custody_chunk_response_processing(spec, state, custody_response) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") diff --git a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_custody_key_reveal.py b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_custody_key_reveal.py index 00a6112bf..2ea70703a 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_custody_key_reveal.py +++ b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_custody_key_reveal.py @@ -1,7 +1,7 @@ from eth2spec.test.helpers.custody import get_valid_custody_key_reveal from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, with_all_phases_except, spec_state_test, expect_assertion_error, @@ -40,7 +40,7 @@ def run_custody_key_reveal_processing(spec, state, custody_key_reveal, valid=Tru yield 'post', state -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls def test_success(spec, state): @@ -50,7 +50,7 @@ def test_success(spec, state): yield from run_custody_key_reveal_processing(spec, state, custody_key_reveal) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls def test_reveal_too_early(spec, state): @@ -59,7 +59,7 @@ def test_reveal_too_early(spec, state): yield from run_custody_key_reveal_processing(spec, state, custody_key_reveal, False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls def test_wrong_period(spec, state): @@ -68,7 +68,7 @@ def test_wrong_period(spec, state): yield from run_custody_key_reveal_processing(spec, state, custody_key_reveal, False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls def test_late_reveal(spec, state): @@ -78,7 +78,7 @@ def test_late_reveal(spec, state): yield from run_custody_key_reveal_processing(spec, state, custody_key_reveal) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls def test_double_reveal(spec, state): diff --git a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_custody_slashing.py b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_custody_slashing.py index 1f46bcf05..732d7da05 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_custody_slashing.py +++ b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_custody_slashing.py @@ -11,7 +11,7 @@ from eth2spec.test.helpers.state import get_balance, transition_to from eth2spec.test.context import ( PHASE0, MINIMAL, - LIGHTCLIENT_PATCH, + ALTAIR, with_all_phases_except, spec_state_test, expect_assertion_error, @@ -113,7 +113,7 @@ def run_standard_custody_slashing_test(spec, yield from run_custody_slashing_processing(spec, state, slashing, valid=valid, correct=correct) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -121,7 +121,7 @@ def test_custody_slashing(spec, state): yield from run_standard_custody_slashing_test(spec, state) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -129,7 +129,7 @@ def test_incorrect_custody_slashing(spec, state): yield from run_standard_custody_slashing_test(spec, state, correct=False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -137,7 +137,7 @@ def test_multiple_epochs_custody(spec, state): yield from run_standard_custody_slashing_test(spec, state, shard_lateness=spec.SLOTS_PER_EPOCH * 3) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") @@ -145,7 +145,7 @@ def test_many_epochs_custody(spec, state): yield from run_standard_custody_slashing_test(spec, state, shard_lateness=spec.SLOTS_PER_EPOCH * 5) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @disable_process_reveal_deadlines @with_configs([MINIMAL], reason="too slow") diff --git a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_early_derived_secret_reveal.py b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_early_derived_secret_reveal.py index 3094f795b..12cdfdff0 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_early_derived_secret_reveal.py +++ b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_early_derived_secret_reveal.py @@ -2,7 +2,7 @@ from eth2spec.test.helpers.custody import get_valid_early_derived_secret_reveal from eth2spec.test.helpers.state import next_epoch_via_block, get_balance from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, with_all_phases_except, spec_state_test, expect_assertion_error, @@ -42,7 +42,7 @@ def run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, v yield 'post', state -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls def test_success(spec, state): @@ -51,7 +51,7 @@ def test_success(spec, state): yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @never_bls def test_reveal_from_current_epoch(spec, state): @@ -60,7 +60,7 @@ def test_reveal_from_current_epoch(spec, state): yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @never_bls def test_reveal_from_past_epoch(spec, state): @@ -70,7 +70,7 @@ def test_reveal_from_past_epoch(spec, state): yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls def test_reveal_with_custody_padding(spec, state): @@ -82,7 +82,7 @@ def test_reveal_with_custody_padding(spec, state): yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, True) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls def test_reveal_with_custody_padding_minus_one(spec, state): @@ -94,7 +94,7 @@ def test_reveal_with_custody_padding_minus_one(spec, state): yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, True) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @never_bls def test_double_reveal(spec, state): @@ -115,7 +115,7 @@ def test_double_reveal(spec, state): yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal2, False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @never_bls def test_revealer_is_slashed(spec, state): @@ -125,7 +125,7 @@ def test_revealer_is_slashed(spec, state): yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @never_bls def test_far_future_epoch(spec, state): diff --git a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_shard_transition.py b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_shard_transition.py index d2b7962b6..2ee2d34c2 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_shard_transition.py +++ b/tests/core/pyspec/eth2spec/test/phase1/block_processing/test_process_shard_transition.py @@ -1,6 +1,6 @@ from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, with_all_phases_except, only_full_crosslink, spec_state_test, @@ -91,21 +91,21 @@ def run_successful_crosslink_tests(spec, state, target_len_offset_slot): assert bool(pending_attestation.crosslink_success) is True -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_basic_crosslinks(spec, state): yield from run_successful_crosslink_tests(spec, state, target_len_offset_slot=1) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_multiple_offset_slots(spec, state): yield from run_successful_crosslink_tests(spec, state, target_len_offset_slot=2) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_no_winning_root(spec, state): @@ -153,7 +153,7 @@ def test_no_winning_root(spec, state): assert state.shard_states == pre_shard_states -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_wrong_shard_transition_root(spec, state): diff --git a/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_challenge_deadlines.py b/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_challenge_deadlines.py index 1d8adecbc..be058bb4b 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_challenge_deadlines.py +++ b/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_challenge_deadlines.py @@ -8,7 +8,7 @@ from eth2spec.test.helpers.attestations import ( from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, MINIMAL, spec_state_test, with_all_phases_except, @@ -26,7 +26,7 @@ def run_process_challenge_deadlines(spec, state): yield from run_epoch_processing_with(spec, state, 'process_challenge_deadlines') -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @with_configs([MINIMAL], reason="too slow") def test_validator_slashed_after_chunk_challenge(spec, state): diff --git a/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_custody_final_updates.py b/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_custody_final_updates.py index 82ecde7ab..f2d9acc9a 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_custody_final_updates.py +++ b/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_custody_final_updates.py @@ -1,6 +1,6 @@ from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, ) from eth2spec.test.helpers.custody import ( get_valid_chunk_challenge, @@ -30,7 +30,7 @@ def run_process_custody_final_updates(spec, state): yield from run_epoch_processing_with(spec, state, 'process_custody_final_updates') -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test def test_validator_withdrawal_delay(spec, state): transition_to_valid_shard_slot(spec, state) @@ -43,7 +43,7 @@ def test_validator_withdrawal_delay(spec, state): assert state.validators[0].withdrawable_epoch == spec.FAR_FUTURE_EPOCH -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test def test_validator_withdrawal_reenable_after_custody_reveal(spec, state): transition_to_valid_shard_slot(spec, state) @@ -68,7 +68,7 @@ def test_validator_withdrawal_reenable_after_custody_reveal(spec, state): assert state.validators[0].withdrawable_epoch < spec.FAR_FUTURE_EPOCH -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test def test_validator_withdrawal_suspend_after_chunk_challenge(spec, state): transition_to_valid_shard_slot(spec, state) @@ -117,7 +117,7 @@ def test_validator_withdrawal_suspend_after_chunk_challenge(spec, state): assert state.validators[validator_index].withdrawable_epoch == spec.FAR_FUTURE_EPOCH -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test def test_validator_withdrawal_resume_after_chunk_challenge_response(spec, state): transition_to_valid_shard_slot(spec, state) diff --git a/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_reveal_deadlines.py b/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_reveal_deadlines.py index b95082491..7b2094aea 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_reveal_deadlines.py +++ b/tests/core/pyspec/eth2spec/test/phase1/epoch_processing/test_process_reveal_deadlines.py @@ -4,7 +4,7 @@ from eth2spec.test.helpers.custody import ( from eth2spec.test.helpers.state import transition_to from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, MINIMAL, with_all_phases_except, with_configs, @@ -18,7 +18,7 @@ def run_process_challenge_deadlines(spec, state): yield from run_epoch_processing_with(spec, state, 'process_challenge_deadlines') -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @with_configs([MINIMAL], reason="too slow") def test_validator_slashed_after_reveal_deadline(spec, state): @@ -38,7 +38,7 @@ def test_validator_slashed_after_reveal_deadline(spec, state): assert state.validators[0].slashed == 1 -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @with_configs([MINIMAL], reason="too slow") def test_validator_not_slashed_after_reveal(spec, state): diff --git a/tests/core/pyspec/eth2spec/test/phase1/sanity/test_blocks.py b/tests/core/pyspec/eth2spec/test/phase1/sanity/test_blocks.py index ba47adde9..1f17fa911 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/sanity/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/phase1/sanity/test_blocks.py @@ -2,7 +2,7 @@ from typing import Dict, Sequence from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, MINIMAL, with_all_phases_except, spec_state_test, @@ -100,7 +100,7 @@ def run_beacon_block_with_shard_blocks(spec, state, target_len_offset_slot, comm assert post_shard_state.gasprice > pre_gasprice -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_process_beacon_block_with_normal_shard_transition(spec, state): @@ -114,7 +114,7 @@ def test_process_beacon_block_with_normal_shard_transition(spec, state): yield from run_beacon_block_with_shard_blocks(spec, state, target_len_offset_slot, committee_index, shard) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_process_beacon_block_with_empty_proposal_transition(spec, state): @@ -133,7 +133,7 @@ def test_process_beacon_block_with_empty_proposal_transition(spec, state): # -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_with_shard_transition_with_custody_challenge_and_response(spec, state): @@ -167,7 +167,7 @@ def test_with_shard_transition_with_custody_challenge_and_response(spec, state): yield from run_beacon_block(spec, state, block) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @with_configs([MINIMAL]) def test_custody_key_reveal(spec, state): @@ -181,7 +181,7 @@ def test_custody_key_reveal(spec, state): yield from run_beacon_block(spec, state, block) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test def test_early_derived_secret_reveal(spec, state): transition_to_valid_shard_slot(spec, state) @@ -192,7 +192,7 @@ def test_early_derived_secret_reveal(spec, state): yield from run_beacon_block(spec, state, block) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_custody_slashing(spec, state): diff --git a/tests/core/pyspec/eth2spec/test/phase1/sanity/test_shard_blocks.py b/tests/core/pyspec/eth2spec/test/phase1/sanity/test_shard_blocks.py index 1590d2a6e..d27dacc7d 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/sanity/test_shard_blocks.py +++ b/tests/core/pyspec/eth2spec/test/phase1/sanity/test_shard_blocks.py @@ -1,6 +1,6 @@ from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, always_bls, expect_assertion_error, spec_state_test, @@ -44,7 +44,7 @@ def run_shard_blocks(spec, shard_state, signed_shard_block, beacon_parent_state, shard_state.latest_block_root == pre_shard_state.latest_block_root -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls @only_full_crosslink @@ -64,7 +64,7 @@ def test_valid_shard_block(spec, state): # -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_invalid_shard_parent_root(spec, state): @@ -80,7 +80,7 @@ def test_invalid_shard_parent_root(spec, state): yield from run_shard_blocks(spec, shard_state, signed_shard_block, beacon_state, valid=False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_invalid_beacon_parent_root(spec, state): @@ -95,7 +95,7 @@ def test_invalid_beacon_parent_root(spec, state): yield from run_shard_blocks(spec, shard_state, signed_shard_block, beacon_state, valid=False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_invalid_slot(spec, state): @@ -111,7 +111,7 @@ def test_invalid_slot(spec, state): yield from run_shard_blocks(spec, shard_state, signed_shard_block, beacon_state, valid=False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_invalid_proposer_index(spec, state): @@ -131,7 +131,7 @@ def test_invalid_proposer_index(spec, state): yield from run_shard_blocks(spec, shard_state, signed_shard_block, beacon_state, valid=False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls @only_full_crosslink @@ -152,7 +152,7 @@ def test_out_of_bound_offset(spec, state): yield from run_shard_blocks(spec, shard_state, signed_shard_block, beacon_state, valid=False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls @only_full_crosslink @@ -171,7 +171,7 @@ def test_invalid_offset(spec, state): yield from run_shard_blocks(spec, shard_state, signed_shard_block, beacon_state, valid=False) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls @only_full_crosslink @@ -190,7 +190,7 @@ def test_empty_block_body(spec, state): # -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls @only_full_crosslink @@ -209,7 +209,7 @@ def test_invalid_signature(spec, state): # -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls @only_full_crosslink @@ -226,7 +226,7 @@ def test_max_offset(spec, state): yield from run_shard_blocks(spec, shard_state, signed_shard_block, beacon_state) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @always_bls @only_full_crosslink diff --git a/tests/core/pyspec/eth2spec/test/phase1/unittests/fork_choice/test_on_shard_block.py b/tests/core/pyspec/eth2spec/test/phase1/unittests/fork_choice/test_on_shard_block.py index 66d254ed1..225800303 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/unittests/fork_choice/test_on_shard_block.py +++ b/tests/core/pyspec/eth2spec/test/phase1/unittests/fork_choice/test_on_shard_block.py @@ -2,7 +2,7 @@ from eth2spec.utils.ssz.ssz_impl import hash_tree_root from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, spec_state_test, with_all_phases_except, never_bls, @@ -152,7 +152,7 @@ def create_and_apply_beacon_and_shard_blocks(spec, state, store, shard, shard_bl return has_shard_committee -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @never_bls # Set to never_bls for testing `check_pending_shard_blocks` def test_basic(spec, state): @@ -213,7 +213,7 @@ def create_simple_fork(spec, state, store, shard): return head_block, forking_block -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_shard_simple_fork(spec, state): @@ -238,7 +238,7 @@ def test_shard_simple_fork(spec, state): assert spec.get_shard_head(store, shard) == forking_block.message.hash_tree_root() -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test @only_full_crosslink def test_shard_latest_messages_for_different_shards(spec, state): diff --git a/tests/core/pyspec/eth2spec/test/phase1/unittests/test_get_start_shard.py b/tests/core/pyspec/eth2spec/test/phase1/unittests/test_get_start_shard.py index 030357655..646dc6eb7 100644 --- a/tests/core/pyspec/eth2spec/test/phase1/unittests/test_get_start_shard.py +++ b/tests/core/pyspec/eth2spec/test/phase1/unittests/test_get_start_shard.py @@ -1,13 +1,13 @@ from eth2spec.test.context import ( PHASE0, - LIGHTCLIENT_PATCH, + ALTAIR, with_all_phases_except, spec_state_test, ) from eth2spec.test.helpers.state import next_epoch -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test def test_get_committee_count_delta(spec, state): assert spec.get_committee_count_delta(state, 0, 0) == 0 @@ -24,7 +24,7 @@ def test_get_committee_count_delta(spec, state): ) -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test def test_get_start_shard_current_epoch_start(spec, state): assert state.current_epoch_start_shard == 0 @@ -40,7 +40,7 @@ def test_get_start_shard_current_epoch_start(spec, state): assert start_shard == state.current_epoch_start_shard -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test def test_get_start_shard_next_slot(spec, state): next_epoch(spec, state) @@ -58,7 +58,7 @@ def test_get_start_shard_next_slot(spec, state): assert start_shard == expected_start_shard -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test def test_get_start_shard_previous_slot(spec, state): next_epoch(spec, state) @@ -77,7 +77,7 @@ def test_get_start_shard_previous_slot(spec, state): assert start_shard == expected_start_shard -@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH]) +@with_all_phases_except([PHASE0, ALTAIR]) @spec_state_test def test_get_start_shard_far_past_epoch(spec, state): initial_epoch = spec.get_current_epoch(state) diff --git a/tests/formats/forks/README.md b/tests/formats/forks/README.md index cbafd4e2a..2226a3f20 100644 --- a/tests/formats/forks/README.md +++ b/tests/formats/forks/README.md @@ -22,7 +22,7 @@ Key of valid `fork` strings that might be found in `meta.yaml` | String ID | Pre-fork | Post-fork | Function | | - | - | - | - | -| `altair` | Phase 0 | Altair | `upgrade_to_lightclient_patch` | +| `altair` | Phase 0 | Altair | `upgrade_to_altair` | ### `pre.ssz_snappy` diff --git a/tests/generators/README.md b/tests/generators/README.md index 6ccf9f118..f629c8b74 100644 --- a/tests/generators/README.md +++ b/tests/generators/README.md @@ -163,14 +163,14 @@ Another example, to generate tests from pytests: ```python from eth2spec.phase0 import spec as spec_phase0 -from eth2spec.lightclient_patch import spec as spec_lightclient_patch +from eth2spec.altair import spec as spec_altair from eth2spec.phase1 import spec as spec_phase1 -from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH +from eth2spec.test.context import PHASE0, PHASE1, ALTAIR from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators -specs = (spec_phase0, spec_lightclient_patch, spec_phase1) +specs = (spec_phase0, spec_altair, spec_phase1) if __name__ == "__main__": @@ -178,7 +178,7 @@ if __name__ == "__main__": 'blocks', 'slots', ]} - lightclient_patch_mods = {**{key: 'eth2spec.test.lightclient_patch.sanity.test_' + key for key in [ + altair_mods = {**{key: 'eth2spec.test.altair.sanity.test_' + key for key in [ 'blocks', ]}, **phase_0_mods} # also run the previous phase 0 tests phase_1_mods = {**{key: 'eth2spec.test.phase1.sanity.test_' + key for key in [ @@ -188,7 +188,7 @@ if __name__ == "__main__": all_mods = { PHASE0: phase_0_mods, - LIGHTCLIENT_PATCH: lightclient_patch_mods, + ALTAIR: altair_mods, PHASE1: phase_1_mods, } diff --git a/tests/generators/epoch_processing/main.py b/tests/generators/epoch_processing/main.py index 50a1e2b57..5207330a7 100644 --- a/tests/generators/epoch_processing/main.py +++ b/tests/generators/epoch_processing/main.py @@ -1,11 +1,11 @@ from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators from eth2spec.phase0 import spec as spec_phase0 -from eth2spec.lightclient_patch import spec as spec_lightclient_patch +from eth2spec.altair import spec as spec_altair from eth2spec.phase1 import spec as spec_phase1 -from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH +from eth2spec.test.context import PHASE0, PHASE1, ALTAIR -specs = (spec_phase0, spec_lightclient_patch, spec_phase1) +specs = (spec_phase0, spec_altair, spec_phase1) if __name__ == "__main__": @@ -21,8 +21,8 @@ if __name__ == "__main__": 'historical_roots_update', 'participation_record_updates', ]} - lightclient_patch_mods = { - **{key: 'eth2spec.test.lightclient_patch.epoch_processing.test_process_' + key for key in [ + altair_mods = { + **{key: 'eth2spec.test.altair.epoch_processing.test_process_' + key for key in [ 'sync_committee_updates', ]}, **phase_0_mods, @@ -35,7 +35,7 @@ if __name__ == "__main__": all_mods = { PHASE0: phase_0_mods, - LIGHTCLIENT_PATCH: lightclient_patch_mods, + ALTAIR: altair_mods, PHASE1: phase_1_mods, } diff --git a/tests/generators/finality/main.py b/tests/generators/finality/main.py index 8b961f9f4..5598028a2 100644 --- a/tests/generators/finality/main.py +++ b/tests/generators/finality/main.py @@ -1,22 +1,22 @@ from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators from eth2spec.phase0 import spec as spec_phase0 -from eth2spec.lightclient_patch import spec as spec_lightclient_patch +from eth2spec.altair import spec as spec_altair from eth2spec.phase1 import spec as spec_phase1 -from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH +from eth2spec.test.context import PHASE0, PHASE1, ALTAIR -specs = (spec_phase0, spec_lightclient_patch, spec_phase1) +specs = (spec_phase0, spec_altair, spec_phase1) if __name__ == "__main__": phase_0_mods = {'finality': 'eth2spec.test.phase0.finality.test_finality'} - # No additional lightclient_patch or phase 1 specific finality tests, yet. - lightclient_patch_mods = phase_0_mods + # No additional altair or phase 1 specific finality tests, yet. + altair_mods = phase_0_mods phase_1_mods = phase_0_mods all_mods = { PHASE0: phase_0_mods, - LIGHTCLIENT_PATCH: lightclient_patch_mods, + ALTAIR: altair_mods, PHASE1: phase_1_mods, } diff --git a/tests/generators/forks/main.py b/tests/generators/forks/main.py index 190d4620c..3bec19735 100644 --- a/tests/generators/forks/main.py +++ b/tests/generators/forks/main.py @@ -1,11 +1,11 @@ from importlib import reload from typing import Iterable -from eth2spec.test.context import PHASE0, LIGHTCLIENT_PATCH, MINIMAL, MAINNET +from eth2spec.test.context import PHASE0, ALTAIR, MINIMAL, MAINNET from eth2spec.config import config_util -from eth2spec.test.lightclient_patch.fork import test_fork as test_altair_forks +from eth2spec.test.altair.fork import test_fork as test_altair_forks from eth2spec.phase0 import spec as spec_phase0 -from eth2spec.lightclient_patch import spec as spec_lightclient_patch +from eth2spec.altair import spec as spec_altair from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing from eth2spec.gen_helpers.gen_from_tests.gen import generate_from_tests @@ -16,7 +16,7 @@ def create_provider(tests_src, config_name: str, phase: str, fork_name: str) -> def prepare_fn(configs_path: str) -> str: config_util.prepare_config(configs_path, config_name) reload(spec_phase0) - reload(spec_lightclient_patch) + reload(spec_altair) return config_name def cases_fn() -> Iterable[gen_typing.TestCase]: @@ -33,6 +33,6 @@ def create_provider(tests_src, config_name: str, phase: str, fork_name: str) -> if __name__ == "__main__": gen_runner.run_generator("forks", [ - create_provider(test_altair_forks, MINIMAL, PHASE0, LIGHTCLIENT_PATCH), - create_provider(test_altair_forks, MAINNET, PHASE0, LIGHTCLIENT_PATCH), + create_provider(test_altair_forks, MINIMAL, PHASE0, ALTAIR), + create_provider(test_altair_forks, MAINNET, PHASE0, ALTAIR), ]) diff --git a/tests/generators/operations/main.py b/tests/generators/operations/main.py index 00a58288f..f5c181710 100644 --- a/tests/generators/operations/main.py +++ b/tests/generators/operations/main.py @@ -1,11 +1,11 @@ from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators from eth2spec.phase0 import spec as spec_phase0 -from eth2spec.lightclient_patch import spec as spec_lightclient_patch +from eth2spec.altair import spec as spec_altair from eth2spec.phase1 import spec as spec_phase1 -from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH +from eth2spec.test.context import PHASE0, PHASE1, ALTAIR -specs = (spec_phase0, spec_lightclient_patch, spec_phase1) +specs = (spec_phase0, spec_altair, spec_phase1) if __name__ == "__main__": @@ -17,8 +17,8 @@ if __name__ == "__main__": 'proposer_slashing', 'voluntary_exit', ]} - lightclient_patch_mods = { - **{key: 'eth2spec.test.lightclient_patch.block_processing.test_process_' + key for key in [ + altair_mods = { + **{key: 'eth2spec.test.altair.block_processing.test_process_' + key for key in [ 'sync_committee', ]}, **phase_0_mods, @@ -34,7 +34,7 @@ if __name__ == "__main__": all_mods = { PHASE0: phase_0_mods, - LIGHTCLIENT_PATCH: lightclient_patch_mods, + ALTAIR: altair_mods, PHASE1: phase_1_mods, } diff --git a/tests/generators/rewards/main.py b/tests/generators/rewards/main.py index 4124587cc..3a7e8f63d 100644 --- a/tests/generators/rewards/main.py +++ b/tests/generators/rewards/main.py @@ -1,11 +1,11 @@ from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators from eth2spec.phase0 import spec as spec_phase0 -from eth2spec.lightclient_patch import spec as spec_lightclient_patch +from eth2spec.altair import spec as spec_altair from eth2spec.phase1 import spec as spec_phase1 -from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH +from eth2spec.test.context import PHASE0, PHASE1, ALTAIR -specs = (spec_phase0, spec_lightclient_patch, spec_phase1) +specs = (spec_phase0, spec_altair, spec_phase1) if __name__ == "__main__": @@ -14,13 +14,13 @@ if __name__ == "__main__": 'leak', 'random', ]} - # No additional lightclient_patch or phase 1 specific rewards tests, yet. - lightclient_patch_mods = phase_0_mods + # No additional altair or phase 1 specific rewards tests, yet. + altair_mods = phase_0_mods phase_1_mods = phase_0_mods all_mods = { PHASE0: phase_0_mods, - LIGHTCLIENT_PATCH: lightclient_patch_mods, + ALTAIR: altair_mods, PHASE1: phase_1_mods, } diff --git a/tests/generators/sanity/main.py b/tests/generators/sanity/main.py index 5155798ff..a0ec2aaae 100644 --- a/tests/generators/sanity/main.py +++ b/tests/generators/sanity/main.py @@ -1,12 +1,12 @@ from eth2spec.phase0 import spec as spec_phase0 -from eth2spec.lightclient_patch import spec as spec_lightclient_patch +from eth2spec.altair import spec as spec_altair from eth2spec.phase1 import spec as spec_phase1 -from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH +from eth2spec.test.context import PHASE0, PHASE1, ALTAIR from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators -specs = (spec_phase0, spec_lightclient_patch, spec_phase1) +specs = (spec_phase0, spec_altair, spec_phase1) if __name__ == "__main__": @@ -14,7 +14,7 @@ if __name__ == "__main__": 'blocks', 'slots', ]} - lightclient_patch_mods = {**{key: 'eth2spec.test.lightclient_patch.sanity.test_' + key for key in [ + altair_mods = {**{key: 'eth2spec.test.altair.sanity.test_' + key for key in [ 'blocks', ]}, **phase_0_mods} # also run the previous phase 0 tests phase_1_mods = {**{key: 'eth2spec.test.phase1.sanity.test_' + key for key in [ @@ -24,7 +24,7 @@ if __name__ == "__main__": all_mods = { PHASE0: phase_0_mods, - LIGHTCLIENT_PATCH: lightclient_patch_mods, + ALTAIR: altair_mods, PHASE1: phase_1_mods, } diff --git a/tests/generators/ssz_static/main.py b/tests/generators/ssz_static/main.py index e21fc4141..e06e3edc8 100644 --- a/tests/generators/ssz_static/main.py +++ b/tests/generators/ssz_static/main.py @@ -9,8 +9,8 @@ from eth2spec.debug import random_value, encode from eth2spec.config import config_util from eth2spec.phase0 import spec as spec_phase0 from eth2spec.phase1 import spec as spec_phase1 -from eth2spec.lightclient_patch import spec as spec_lightclient_patch -from eth2spec.test.context import PHASE1, LIGHTCLIENT_PATCH, TESTGEN_FORKS, MINIMAL, MAINNET +from eth2spec.altair import spec as spec_altair +from eth2spec.test.context import PHASE1, ALTAIR, TESTGEN_FORKS, MINIMAL, MAINNET from eth2spec.utils.ssz.ssz_typing import Container from eth2spec.utils.ssz.ssz_impl import ( hash_tree_root, @@ -65,7 +65,7 @@ def create_provider(fork_name, config_name: str, seed: int, mode: random_value.R config_util.prepare_config(configs_path, config_name) reload(spec_phase0) reload(spec_phase1) - reload(spec_lightclient_patch) + reload(spec_altair) return config_name def cases_fn() -> Iterable[gen_typing.TestCase]: @@ -73,8 +73,8 @@ def create_provider(fork_name, config_name: str, seed: int, mode: random_value.R spec = spec_phase0 if fork_name == PHASE1: spec = spec_phase1 - if fork_name == LIGHTCLIENT_PATCH: - spec = spec_lightclient_patch + if fork_name == ALTAIR: + spec = spec_altair for (i, (name, ssz_type)) in enumerate(get_spec_ssz_types(spec)): yield from ssz_static_cases(fork_name, seed * 1000 + i, name, ssz_type, mode, chaos, count) From b9c95b722d9400c29bb0258619e94c665d43d89a Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Thu, 11 Mar 2021 08:55:55 -0700 Subject: [PATCH 10/10] one more hf-1 to Altair conversion --- specs/altair/beacon-chain.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index d2e060cdf..51817fd21 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -519,9 +519,8 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None: # Add validator and balance entries state.validators.append(get_validator_from_deposit(state, deposit)) state.balances.append(amount) - # [Added in hf-1] Initialize empty participation flags for new validator - state.previous_epoch_participation.append(ParticipationFlags(0b0000_0000)) - state.current_epoch_participation.append(ParticipationFlags(0b0000_0000)) + state.previous_epoch_participation.append(ParticipationFlags(0b0000_0000)) # [New in Altair] + state.current_epoch_participation.append(ParticipationFlags(0b0000_0000)) # [New in Altair] else: # Increase balance by deposit amount index = ValidatorIndex(validator_pubkeys.index(pubkey))