LIGHTCLIENT_PATCH/HF1 -> ALTAIR
This commit is contained in:
parent
69489d1541
commit
b44e576e95
|
@ -17,7 +17,7 @@ eth2.0-spec-tests/
|
||||||
# Dynamically built from Markdown spec
|
# Dynamically built from Markdown spec
|
||||||
tests/core/pyspec/eth2spec/phase0/
|
tests/core/pyspec/eth2spec/phase0/
|
||||||
tests/core/pyspec/eth2spec/phase1/
|
tests/core/pyspec/eth2spec/phase1/
|
||||||
tests/core/pyspec/eth2spec/lightclient_patch/
|
tests/core/pyspec/eth2spec/altair/
|
||||||
|
|
||||||
# coverage reports
|
# coverage reports
|
||||||
.htmlcov
|
.htmlcov
|
||||||
|
|
10
Makefile
10
Makefile
|
@ -20,7 +20,7 @@ GENERATOR_VENVS = $(patsubst $(GENERATOR_DIR)/%, $(GENERATOR_DIR)/%venv, $(GENER
|
||||||
# To check generator matching:
|
# To check generator matching:
|
||||||
#$(info $$GENERATOR_TARGETS is [${GENERATOR_TARGETS}])
|
#$(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_HTML_OUT=.htmlcov
|
||||||
COV_INDEX_FILE=$(PY_SPEC_DIR)/$(COV_HTML_OUT)/index.html
|
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 $(DEPOSIT_CONTRACT_TESTER_DIR)/.pytest_cache
|
||||||
rm -rf $(PY_SPEC_DIR)/phase0
|
rm -rf $(PY_SPEC_DIR)/phase0
|
||||||
rm -rf $(PY_SPEC_DIR)/phase1
|
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)/$(COV_HTML_OUT)
|
||||||
rm -rf $(PY_SPEC_DIR)/.coverage
|
rm -rf $(PY_SPEC_DIR)/.coverage
|
||||||
rm -rf $(PY_SPEC_DIR)/test-reports
|
rm -rf $(PY_SPEC_DIR)/test-reports
|
||||||
|
@ -86,11 +86,11 @@ install_test:
|
||||||
|
|
||||||
test: pyspec
|
test: pyspec
|
||||||
. venv/bin/activate; cd $(PY_SPEC_DIR); \
|
. 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
|
find_test: pyspec
|
||||||
. venv/bin/activate; cd $(PY_SPEC_DIR); \
|
. 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
|
citest: pyspec
|
||||||
mkdir -p tests/core/pyspec/test-reports/eth2spec; . venv/bin/activate; cd $(PY_SPEC_DIR); \
|
mkdir -p tests/core/pyspec/test-reports/eth2spec; . venv/bin/activate; cd $(PY_SPEC_DIR); \
|
||||||
|
@ -113,7 +113,7 @@ codespell:
|
||||||
lint: pyspec
|
lint: pyspec
|
||||||
. venv/bin/activate; cd $(PY_SPEC_DIR); \
|
. venv/bin/activate; cd $(PY_SPEC_DIR); \
|
||||||
flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \
|
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
|
lint_generators: pyspec
|
||||||
. venv/bin/activate; cd $(TEST_GENERATORS_DIR); \
|
. venv/bin/activate; cd $(TEST_GENERATORS_DIR); \
|
||||||
|
|
|
@ -21,10 +21,11 @@ Core specifications for Eth2 clients be found in [specs](specs/). These are divi
|
||||||
* [Honest Validator](specs/phase0/validator.md)
|
* [Honest Validator](specs/phase0/validator.md)
|
||||||
* [P2P Networking](specs/phase0/p2p-interface.md)
|
* [P2P Networking](specs/phase0/p2p-interface.md)
|
||||||
|
|
||||||
### Light clients
|
### Altair
|
||||||
|
|
||||||
* [Beacon chain changes](specs/lightclient/beacon-chain.md)
|
* [Beacon chain changes](specs/altair/beacon-chain.md)
|
||||||
* [Light client sync protocol](specs/lightclient/sync-protocol.md)
|
* [Altair fork](specs/altair/fork.md)
|
||||||
|
* [Light client sync protocol](specs/altair/sync-protocol.md)
|
||||||
|
|
||||||
### Sharding
|
### Sharding
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
# Mainnet preset - lightclient patch
|
# Mainnet preset - Altair
|
||||||
|
|
||||||
CONFIG_NAME: "mainnet"
|
CONFIG_NAME: "mainnet"
|
||||||
|
|
||||||
# Updated penalty values
|
# Updated penalty values
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# 3 * 2**24) (= 50,331,648)
|
# 3 * 2**24) (= 50,331,648)
|
||||||
HF1_INACTIVITY_PENALTY_QUOTIENT: 50331648
|
ALTAIR_INACTIVITY_PENALTY_QUOTIENT: 50331648
|
||||||
# 2**6 (= 64)
|
# 2**6 (= 64)
|
||||||
HF1_MIN_SLASHING_PENALTY_QUOTIENT: 64
|
ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT: 64
|
||||||
# 2
|
# 2
|
||||||
HF1_PROPORTIONAL_SLASHING_MULTIPLIER: 2
|
ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER: 2
|
||||||
|
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
# Minimal preset - lightclient patch
|
# Minimal preset - Altair
|
||||||
|
|
||||||
CONFIG_NAME: "minimal"
|
CONFIG_NAME: "minimal"
|
||||||
|
|
||||||
# Updated penalty values
|
# Updated penalty values
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# 3 * 2**24) (= 50,331,648)
|
# 3 * 2**24) (= 50,331,648)
|
||||||
HF1_INACTIVITY_PENALTY_QUOTIENT: 50331648
|
ALTAIR_INACTIVITY_PENALTY_QUOTIENT: 50331648
|
||||||
# 2**6 (= 64)
|
# 2**6 (= 64)
|
||||||
HF1_MIN_SLASHING_PENALTY_QUOTIENT: 64
|
ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT: 64
|
||||||
# 2
|
# 2
|
||||||
HF1_PROPORTIONAL_SLASHING_MULTIPLIER: 2
|
ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER: 2
|
||||||
|
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
|
|
12
setup.py
12
setup.py
|
@ -179,7 +179,7 @@ from eth2spec.utils import bls
|
||||||
|
|
||||||
from eth2spec.utils.hash_function import hash
|
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
|
from importlib import reload
|
||||||
reload(phase0)
|
reload(phase0)
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ def combine_spec_objects(spec0: SpecObject, spec1: SpecObject) -> SpecObject:
|
||||||
fork_imports = {
|
fork_imports = {
|
||||||
'phase0': PHASE0_IMPORTS,
|
'phase0': PHASE0_IMPORTS,
|
||||||
'phase1': PHASE1_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/shard-fork-choice.md
|
||||||
specs/phase1/validator.md
|
specs/phase1/validator.md
|
||||||
"""
|
"""
|
||||||
elif self.spec_fork == "lightclient_patch":
|
elif self.spec_fork == "altair":
|
||||||
self.md_doc_paths = """
|
self.md_doc_paths = """
|
||||||
specs/phase0/beacon-chain.md
|
specs/phase0/beacon-chain.md
|
||||||
specs/phase0/fork-choice.md
|
specs/phase0/fork-choice.md
|
||||||
specs/phase0/validator.md
|
specs/phase0/validator.md
|
||||||
specs/phase0/weak-subjectivity.md
|
specs/phase0/weak-subjectivity.md
|
||||||
specs/lightclient/beacon-chain.md
|
specs/altair/beacon-chain.md
|
||||||
specs/lightclient/fork.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:
|
else:
|
||||||
raise Exception('no markdown files specified, and spec fork "%s" is unknown', self.spec_fork)
|
raise Exception('no markdown files specified, and spec fork "%s" is unknown', self.spec_fork)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Ethereum 2.0 HF1
|
# Ethereum 2.0 Altair
|
||||||
|
|
||||||
## Table of contents
|
## Table of contents
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
|
|
||||||
## Introduction
|
## 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:
|
It has four main features:
|
||||||
|
|
||||||
* Light client support via sync committees
|
* 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 |
|
| Name | Value |
|
||||||
| - | - |
|
| - | - |
|
||||||
| `HF1_INACTIVITY_PENALTY_QUOTIENT` | `uint64(3 * 2**24)` (= 50,331,648) |
|
| `ALTAIR_INACTIVITY_PENALTY_QUOTIENT` | `uint64(3 * 2**24)` (= 50,331,648) |
|
||||||
| `HF1_MIN_SLASHING_PENALTY_QUOTIENT` | `uint64(2**6)` (=64) |
|
| `ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT` | `uint64(2**6)` (=64) |
|
||||||
| `HF1_PROPORTIONAL_SLASHING_MULTIPLIER` | `uint64(2)` |
|
| `ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER` | `uint64(2)` |
|
||||||
|
|
||||||
### Misc
|
### Misc
|
||||||
|
|
||||||
|
@ -152,8 +152,8 @@ class BeaconBlockBody(Container):
|
||||||
deposits: List[Deposit, MAX_DEPOSITS]
|
deposits: List[Deposit, MAX_DEPOSITS]
|
||||||
voluntary_exits: List[SignedVoluntaryExit, MAX_VOLUNTARY_EXITS]
|
voluntary_exits: List[SignedVoluntaryExit, MAX_VOLUNTARY_EXITS]
|
||||||
# Sync committee aggregate signature
|
# Sync committee aggregate signature
|
||||||
sync_committee_bits: Bitvector[SYNC_COMMITTEE_SIZE] # [New in HF1]
|
sync_committee_bits: Bitvector[SYNC_COMMITTEE_SIZE] # [New in Altair]
|
||||||
sync_committee_signature: BLSSignature # [New in HF1]
|
sync_committee_signature: BLSSignature # [New in Altair]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `BeaconState`
|
#### `BeaconState`
|
||||||
|
@ -379,7 +379,7 @@ def get_inactivity_penalty_deltas(state: BeaconState) -> Tuple[Sequence[Gwei], S
|
||||||
effective_balance = state.validators[index].effective_balance
|
effective_balance = state.validators[index].effective_balance
|
||||||
penalties[index] += Gwei(
|
penalties[index] += Gwei(
|
||||||
effective_balance * get_finality_delay(state)
|
effective_balance * get_finality_delay(state)
|
||||||
// HF1_INACTIVITY_PENALTY_QUOTIENT
|
// ALTAIR_INACTIVITY_PENALTY_QUOTIENT
|
||||||
)
|
)
|
||||||
|
|
||||||
rewards = [Gwei(0) for _ in range(len(state.validators))]
|
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`
|
#### New `slash_validator`
|
||||||
|
|
||||||
*Note*: The function `slash_validator` is modified
|
*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
|
```python
|
||||||
def slash_validator(state: BeaconState,
|
def slash_validator(state: BeaconState,
|
||||||
|
@ -406,7 +406,7 @@ def slash_validator(state: BeaconState,
|
||||||
validator.slashed = True
|
validator.slashed = True
|
||||||
validator.withdrawable_epoch = max(validator.withdrawable_epoch, Epoch(epoch + EPOCHS_PER_SLASHINGS_VECTOR))
|
validator.withdrawable_epoch = max(validator.withdrawable_epoch, Epoch(epoch + EPOCHS_PER_SLASHINGS_VECTOR))
|
||||||
state.slashings[epoch % EPOCHS_PER_SLASHINGS_VECTOR] += validator.effective_balance
|
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
|
# Apply proposer and whistleblower rewards
|
||||||
proposer_index = get_beacon_proposer_index(state)
|
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_block_header(state, block)
|
||||||
process_randao(state, block.body)
|
process_randao(state, block.body)
|
||||||
process_eth1_data(state, block.body)
|
process_eth1_data(state, block.body)
|
||||||
process_operations(state, block.body) # [Modified in HF1]
|
process_operations(state, block.body) # [Modified in Altair]
|
||||||
process_sync_committee(state, block.body) # [New in HF1]
|
process_sync_committee(state, block.body) # [New in Altair]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Modified `process_attestation`
|
#### Modified `process_attestation`
|
||||||
|
@ -561,17 +561,17 @@ def process_sync_committee(state: BeaconState, body: BeaconBlockBody) -> None:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def process_epoch(state: BeaconState) -> None:
|
def process_epoch(state: BeaconState) -> None:
|
||||||
process_justification_and_finalization(state) # [Modified in HF1]
|
process_justification_and_finalization(state) # [Modified in Altair]
|
||||||
process_rewards_and_penalties(state) # [Modified in HF1]
|
process_rewards_and_penalties(state) # [Modified in Altair]
|
||||||
process_registry_updates(state)
|
process_registry_updates(state)
|
||||||
process_slashings(state) # [Modified in HF1]
|
process_slashings(state) # [Modified in Altair]
|
||||||
process_eth1_data_reset(state)
|
process_eth1_data_reset(state)
|
||||||
process_effective_balance_updates(state)
|
process_effective_balance_updates(state)
|
||||||
process_slashings_reset(state)
|
process_slashings_reset(state)
|
||||||
process_randao_mixes_reset(state)
|
process_randao_mixes_reset(state)
|
||||||
process_historical_roots_update(state)
|
process_historical_roots_update(state)
|
||||||
process_participation_flag_updates(state) # [New in HF1]
|
process_participation_flag_updates(state) # [New in Altair]
|
||||||
process_sync_committee_updates(state) # [New in HF1]
|
process_sync_committee_updates(state) # [New in Altair]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Justification and finalization
|
#### Justification and finalization
|
||||||
|
@ -642,13 +642,13 @@ def process_rewards_and_penalties(state: BeaconState) -> None:
|
||||||
|
|
||||||
#### Slashings
|
#### 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
|
```python
|
||||||
def process_slashings(state: BeaconState) -> None:
|
def process_slashings(state: BeaconState) -> None:
|
||||||
epoch = get_current_epoch(state)
|
epoch = get_current_epoch(state)
|
||||||
total_balance = get_total_active_balance(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):
|
for index, validator in enumerate(state.validators):
|
||||||
if validator.slashed and epoch + EPOCHS_PER_SLASHINGS_VECTOR // 2 == validator.withdrawable_epoch:
|
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
|
increment = EFFECTIVE_BALANCE_INCREMENT # Factored out from penalty numerator to avoid uint64 overflow
|
||||||
|
|
|
@ -25,21 +25,21 @@ Warning: this configuration is not definitive.
|
||||||
|
|
||||||
| Name | Value |
|
| Name | Value |
|
||||||
| - | - |
|
| - | - |
|
||||||
| `LIGHTCLIENT_PATCH_FORK_VERSION` | `Version('0x01000000')` |
|
| `ALTAIR_FORK_VERSION` | `Version('0x01000000')` |
|
||||||
| `LIGHTCLIENT_PATCH_FORK_SLOT` | `Slot(0)` **TBD** |
|
| `ALTAIR_FORK_SLOT` | `Slot(0)` **TBD** |
|
||||||
|
|
||||||
## Fork to Light-client patch
|
## Fork to Light-client patch
|
||||||
|
|
||||||
### Fork trigger
|
### 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
|
### 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
|
```python
|
||||||
def upgrade_to_lightclient_patch(pre: phase0.BeaconState) -> BeaconState:
|
def upgrade_to_altair(pre: phase0.BeaconState) -> BeaconState:
|
||||||
epoch = get_current_epoch(pre)
|
epoch = get_current_epoch(pre)
|
||||||
post = BeaconState(
|
post = BeaconState(
|
||||||
genesis_time=pre.genesis_time,
|
genesis_time=pre.genesis_time,
|
||||||
|
@ -47,7 +47,7 @@ def upgrade_to_lightclient_patch(pre: phase0.BeaconState) -> BeaconState:
|
||||||
slot=pre.slot,
|
slot=pre.slot,
|
||||||
fork=Fork(
|
fork=Fork(
|
||||||
previous_version=pre.fork.current_version,
|
previous_version=pre.fork.current_version,
|
||||||
current_version=LIGHTCLIENT_PATCH_FORK_VERSION,
|
current_version=ALTAIR_FORK_VERSION,
|
||||||
epoch=epoch,
|
epoch=epoch,
|
||||||
),
|
),
|
||||||
# History
|
# History
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0, LIGHTCLIENT_PATCH,
|
PHASE0, ALTAIR,
|
||||||
with_phases,
|
with_phases,
|
||||||
with_custom_state,
|
with_custom_state,
|
||||||
spec_test, with_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',
|
'fork': 'altair',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ HF1_FORK_TEST_META_TAGS = {
|
||||||
def run_fork_test(post_spec, pre_state):
|
def run_fork_test(post_spec, pre_state):
|
||||||
yield 'pre', 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
|
||||||
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 getattr(pre_state, field) != getattr(post_state, field)
|
||||||
|
|
||||||
assert pre_state.fork.current_version == post_state.fork.previous_version
|
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)
|
assert post_state.fork.epoch == post_spec.get_current_epoch(post_state)
|
||||||
|
|
||||||
yield 'post', post_state
|
yield 'post', post_state
|
||||||
|
|
||||||
|
|
||||||
@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH])
|
@with_phases(phases=[PHASE0], other_phases=[ALTAIR])
|
||||||
@spec_test
|
@spec_test
|
||||||
@with_state
|
@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):
|
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
|
@spec_test
|
||||||
@with_state
|
@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):
|
def test_fork_next_epoch(spec, phases, state):
|
||||||
next_epoch(spec, 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
|
@spec_test
|
||||||
@with_state
|
@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):
|
def test_fork_next_epoch_with_block(spec, phases, state):
|
||||||
next_epoch_via_block(spec, 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
|
@spec_test
|
||||||
@with_state
|
@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):
|
def test_fork_many_next_epoch(spec, phases, state):
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
next_epoch(spec, 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])
|
||||||
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
||||||
@spec_test
|
@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):
|
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)
|
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
||||||
@spec_test
|
@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):
|
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)
|
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
||||||
@spec_test
|
@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):
|
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)
|
||||||
|
|
|
@ -2,7 +2,7 @@ import pytest
|
||||||
|
|
||||||
from eth2spec.phase0 import spec as spec_phase0
|
from eth2spec.phase0 import spec as spec_phase0
|
||||||
from eth2spec.phase1 import spec as spec_phase1
|
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 eth2spec.utils import bls
|
||||||
|
|
||||||
from .exceptions import SkippedTest
|
from .exceptions import SkippedTest
|
||||||
|
@ -20,7 +20,7 @@ from importlib import reload
|
||||||
def reload_specs():
|
def reload_specs():
|
||||||
reload(spec_phase0)
|
reload(spec_phase0)
|
||||||
reload(spec_phase1)
|
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.
|
# 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')
|
PHASE0 = SpecForkName('phase0')
|
||||||
PHASE1 = SpecForkName('phase1')
|
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')
|
MAINNET = ConfigName('mainnet')
|
||||||
MINIMAL = ConfigName('minimal')
|
MINIMAL = ConfigName('minimal')
|
||||||
|
@ -40,7 +40,7 @@ MINIMAL = ConfigName('minimal')
|
||||||
ALL_CONFIGS = (MINIMAL, MAINNET)
|
ALL_CONFIGS = (MINIMAL, MAINNET)
|
||||||
|
|
||||||
# The forks that output to the test vectors.
|
# 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.
|
# TODO: currently phases are defined as python modules.
|
||||||
# It would be better if they would be more well-defined interfaces for stronger typing.
|
# 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):
|
class SpecForks(TypedDict, total=False):
|
||||||
PHASE0: SpecPhase0
|
PHASE0: SpecPhase0
|
||||||
PHASE1: SpecPhase1
|
PHASE1: SpecPhase1
|
||||||
LIGHTCLIENT_PATCH: SpecLightclient
|
ALTAIR: SpecLightclient
|
||||||
|
|
||||||
|
|
||||||
def _prepare_state(balances_fn: Callable[[Any], Sequence[int]], threshold_fn: Callable[[Any], int],
|
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.
|
# TODO: instead of upgrading a test phase0 genesis state we can also write a phase1 state helper.
|
||||||
# Decide based on performance/consistency results later.
|
# Decide based on performance/consistency results later.
|
||||||
state = phases[PHASE1].upgrade_to_phase1(state)
|
state = phases[PHASE1].upgrade_to_phase1(state)
|
||||||
elif spec.fork == LIGHTCLIENT_PATCH:
|
elif spec.fork == ALTAIR:
|
||||||
state = phases[LIGHTCLIENT_PATCH].upgrade_to_lightclient_patch(state)
|
state = phases[ALTAIR].upgrade_to_altair(state)
|
||||||
|
|
||||||
return state
|
return state
|
||||||
|
|
||||||
|
@ -352,16 +352,16 @@ def with_phases(phases, other_phases=None):
|
||||||
phase_dir[PHASE0] = spec_phase0
|
phase_dir[PHASE0] = spec_phase0
|
||||||
if PHASE1 in available_phases:
|
if PHASE1 in available_phases:
|
||||||
phase_dir[PHASE1] = spec_phase1
|
phase_dir[PHASE1] = spec_phase1
|
||||||
if LIGHTCLIENT_PATCH in available_phases:
|
if ALTAIR in available_phases:
|
||||||
phase_dir[LIGHTCLIENT_PATCH] = spec_lightclient_patch
|
phase_dir[ALTAIR] = spec_altair
|
||||||
|
|
||||||
# return is ignored whenever multiple phases are ran. If
|
# return is ignored whenever multiple phases are ran. If
|
||||||
if PHASE0 in run_phases:
|
if PHASE0 in run_phases:
|
||||||
ret = fn(spec=spec_phase0, phases=phase_dir, *args, **kw)
|
ret = fn(spec=spec_phase0, phases=phase_dir, *args, **kw)
|
||||||
if PHASE1 in run_phases:
|
if PHASE1 in run_phases:
|
||||||
ret = fn(spec=spec_phase1, phases=phase_dir, *args, **kw)
|
ret = fn(spec=spec_phase1, phases=phase_dir, *args, **kw)
|
||||||
if LIGHTCLIENT_PATCH in run_phases:
|
if ALTAIR in run_phases:
|
||||||
ret = fn(spec=spec_lightclient_patch, phases=phase_dir, *args, **kw)
|
ret = fn(spec=spec_altair, phases=phase_dir, *args, **kw)
|
||||||
return ret
|
return ret
|
||||||
return wrapper
|
return wrapper
|
||||||
return decorator
|
return decorator
|
||||||
|
@ -397,9 +397,9 @@ def only_full_crosslink(fn):
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
def is_post_lightclient_patch(spec):
|
def is_post_altair(spec):
|
||||||
if spec.fork in [PHASE0, PHASE1]:
|
if spec.fork in [PHASE0, PHASE1]:
|
||||||
# TODO: PHASE1 fork is temporarily parallel to LIGHTCLIENT_PATCH.
|
# TODO: PHASE1 fork is temporarily parallel to ALTAIR.
|
||||||
# Will make PHASE1 fork inherit LIGHTCLIENT_PATCH later.
|
# Will make PHASE1 fork inherit ALTAIR later.
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -2,7 +2,7 @@ from lru import LRU
|
||||||
|
|
||||||
from typing import List
|
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.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.block import build_empty_block_for_next_slot
|
||||||
from eth2spec.test.helpers.shard_transitions import get_shard_transition_of_committee
|
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
|
yield 'post', None
|
||||||
return
|
return
|
||||||
|
|
||||||
if not is_post_lightclient_patch(spec):
|
if not is_post_altair(spec):
|
||||||
current_epoch_count = len(state.current_epoch_attestations)
|
current_epoch_count = len(state.current_epoch_attestations)
|
||||||
previous_epoch_count = len(state.previous_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)
|
spec.process_attestation(state, attestation)
|
||||||
|
|
||||||
# Make sure the attestation has been processed
|
# 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):
|
if attestation.data.target.epoch == spec.get_current_epoch(state):
|
||||||
assert len(state.current_epoch_attestations) == current_epoch_count + 1
|
assert len(state.current_epoch_attestations) == current_epoch_count + 1
|
||||||
else:
|
else:
|
||||||
|
@ -320,7 +320,7 @@ def prepare_state_with_attestations(spec, state, participation_fn=None):
|
||||||
next_slot(spec, state)
|
next_slot(spec, state)
|
||||||
|
|
||||||
assert state.slot == next_epoch_start_slot + spec.MIN_ATTESTATION_INCLUSION_DELAY
|
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)
|
assert len(state.previous_epoch_attestations) == len(attestations)
|
||||||
|
|
||||||
return attestations
|
return attestations
|
||||||
|
|
|
@ -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.test.helpers.keys import privkeys
|
||||||
from eth2spec.utils import bls
|
from eth2spec.utils import bls
|
||||||
from eth2spec.utils.bls import only_with_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.body.eth1_data.deposit_count = state.eth1_deposit_index
|
||||||
empty_block.parent_root = parent_block_root
|
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
|
empty_block.body.sync_committee_signature = spec.G2_POINT_AT_INFINITY
|
||||||
|
|
||||||
apply_randao_reveal(spec, state, empty_block)
|
apply_randao_reveal(spec, state, empty_block)
|
||||||
|
|
|
@ -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):
|
def get_process_calls(spec):
|
||||||
|
@ -16,8 +16,8 @@ def get_process_calls(spec):
|
||||||
'process_slashings_reset',
|
'process_slashings_reset',
|
||||||
'process_randao_mixes_reset',
|
'process_randao_mixes_reset',
|
||||||
'process_historical_roots_update',
|
'process_historical_roots_update',
|
||||||
# HF1 replaced `process_participation_record_updates` with `process_participation_flag_updates`
|
# Altair replaced `process_participation_record_updates` with `process_participation_flag_updates`
|
||||||
'process_participation_flag_updates' if is_post_lightclient_patch(spec) else (
|
'process_participation_flag_updates' if is_post_altair(spec) else (
|
||||||
'process_participation_record_updates'
|
'process_participation_record_updates'
|
||||||
),
|
),
|
||||||
'process_sync_committee_updates',
|
'process_sync_committee_updates',
|
||||||
|
|
|
@ -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.block_header import sign_block_header
|
||||||
from eth2spec.test.helpers.keys import pubkey_to_privkey
|
from eth2spec.test.helpers.keys import pubkey_to_privkey
|
||||||
from eth2spec.test.helpers.state import get_balance
|
from eth2spec.test.helpers.state import get_balance
|
||||||
|
|
||||||
|
|
||||||
def get_min_slashing_penalty_quotient(spec):
|
def get_min_slashing_penalty_quotient(spec):
|
||||||
if is_post_lightclient_patch(spec):
|
if is_post_altair(spec):
|
||||||
return spec.HF1_MIN_SLASHING_PENALTY_QUOTIENT
|
return spec.ALTAIR_MIN_SLASHING_PENALTY_QUOTIENT
|
||||||
else:
|
else:
|
||||||
return spec.MIN_SLASHING_PENALTY_QUOTIENT
|
return spec.MIN_SLASHING_PENALTY_QUOTIENT
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ from random import Random
|
||||||
from lru import LRU
|
from lru import LRU
|
||||||
|
|
||||||
from eth2spec.phase0 import spec as spec_phase0
|
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.attestations import cached_prepare_state_with_attestations
|
||||||
from eth2spec.test.helpers.deposits import mock_deposit
|
from eth2spec.test.helpers.deposits import mock_deposit
|
||||||
from eth2spec.test.helpers.state import next_epoch
|
from eth2spec.test.helpers.state import next_epoch
|
||||||
|
@ -39,7 +39,7 @@ def run_deltas(spec, state):
|
||||||
"""
|
"""
|
||||||
yield 'pre', state
|
yield 'pre', state
|
||||||
|
|
||||||
if is_post_lightclient_patch(spec):
|
if is_post_altair(spec):
|
||||||
def get_source_deltas(state):
|
def get_source_deltas(state):
|
||||||
return spec.get_flag_deltas(state, spec.TIMELY_SOURCE_FLAG_INDEX, spec.TIMELY_SOURCE_FLAG_NUMERATOR)
|
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(
|
yield from run_attestation_component_deltas(
|
||||||
spec,
|
spec,
|
||||||
state,
|
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,
|
spec.get_matching_source_attestations,
|
||||||
'source_deltas',
|
'source_deltas',
|
||||||
)
|
)
|
||||||
yield from run_attestation_component_deltas(
|
yield from run_attestation_component_deltas(
|
||||||
spec,
|
spec,
|
||||||
state,
|
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,
|
spec.get_matching_target_attestations,
|
||||||
'target_deltas',
|
'target_deltas',
|
||||||
)
|
)
|
||||||
yield from run_attestation_component_deltas(
|
yield from run_attestation_component_deltas(
|
||||||
spec,
|
spec,
|
||||||
state,
|
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,
|
spec.get_matching_head_attestations,
|
||||||
'head_deltas',
|
'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)
|
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_attestations = matching_att_fn(state, spec.get_previous_epoch(state))
|
||||||
matching_indices = spec.get_unslashed_attesting_indices(state, matching_attestations)
|
matching_indices = spec.get_unslashed_attesting_indices(state, matching_attestations)
|
||||||
else:
|
else:
|
||||||
|
@ -129,7 +129,7 @@ def run_get_inclusion_delay_deltas(spec, state):
|
||||||
Run ``get_inclusion_delay_deltas``, yielding:
|
Run ``get_inclusion_delay_deltas``, yielding:
|
||||||
- inclusion delay deltas ('inclusion_delay_deltas')
|
- inclusion delay deltas ('inclusion_delay_deltas')
|
||||||
"""
|
"""
|
||||||
if is_post_lightclient_patch(spec):
|
if is_post_altair(spec):
|
||||||
# No inclusion_delay_deltas
|
# No inclusion_delay_deltas
|
||||||
yield 'inclusion_delay_deltas', Deltas(rewards=[0] * len(state.validators),
|
yield 'inclusion_delay_deltas', Deltas(rewards=[0] * len(state.validators),
|
||||||
penalties=[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)
|
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_attestations = spec.get_matching_target_attestations(state, spec.get_previous_epoch(state))
|
||||||
matching_attesting_indices = spec.get_unslashed_attesting_indices(state, matching_attestations)
|
matching_attesting_indices = spec.get_unslashed_attesting_indices(state, matching_attestations)
|
||||||
else:
|
else:
|
||||||
|
@ -200,7 +200,7 @@ def run_get_inactivity_penalty_deltas(spec, state):
|
||||||
|
|
||||||
if spec.is_in_inactivity_leak(state):
|
if spec.is_in_inactivity_leak(state):
|
||||||
# Compute base_penalty
|
# 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
|
cancel_base_rewards_per_epoch = spec.BASE_REWARDS_PER_EPOCH
|
||||||
base_reward = spec.get_base_reward(state, index)
|
base_reward = spec.get_base_reward(state, index)
|
||||||
base_penalty = cancel_base_rewards_per_epoch * base_reward - spec.get_proposer_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)):
|
def run_test_full_but_partial_participation(spec, state, rng=Random(5522)):
|
||||||
cached_prepare_state_with_attestations(spec, state)
|
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:
|
for a in state.previous_epoch_attestations:
|
||||||
a.aggregation_bits = [rng.choice([True, False]) for _ in a.aggregation_bits]
|
a.aggregation_bits = [rng.choice([True, False]) for _ in a.aggregation_bits]
|
||||||
else:
|
else:
|
||||||
|
@ -323,7 +323,7 @@ def run_test_partial(spec, state, fraction_filled):
|
||||||
cached_prepare_state_with_attestations(spec, state)
|
cached_prepare_state_with_attestations(spec, state)
|
||||||
|
|
||||||
# Remove portion of attestations
|
# 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)
|
num_attestations = int(len(state.previous_epoch_attestations) * fraction_filled)
|
||||||
state.previous_epoch_attestations = state.previous_epoch_attestations[:num_attestations]
|
state.previous_epoch_attestations = state.previous_epoch_attestations[:num_attestations]
|
||||||
else:
|
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):
|
def run_test_some_very_low_effective_balances_that_did_not_attest(spec, state):
|
||||||
cached_prepare_state_with_attestations(spec, state)
|
cached_prepare_state_with_attestations(spec, state)
|
||||||
|
|
||||||
if not is_post_lightclient_patch(spec):
|
if not is_post_altair(spec):
|
||||||
# Remove attestation
|
# Remove attestation
|
||||||
attestation = state.previous_epoch_attestations[0]
|
attestation = state.previous_epoch_attestations[0]
|
||||||
state.previous_epoch_attestations = state.previous_epoch_attestations[1:]
|
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)
|
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:
|
for pending_attestation in state.previous_epoch_attestations:
|
||||||
# ~1/3 have bad target
|
# ~1/3 have bad target
|
||||||
if rng.randint(0, 2) == 0:
|
if rng.randint(0, 2) == 0:
|
||||||
|
|
|
@ -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 (
|
from eth2spec.test.helpers.epoch_processing import (
|
||||||
run_epoch_processing_with,
|
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)
|
previous_epoch = spec.get_previous_epoch(state)
|
||||||
current_epoch = spec.get_current_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:
|
if current_epoch == epoch:
|
||||||
attestations = state.current_epoch_attestations
|
attestations = state.current_epoch_attestations
|
||||||
elif previous_epoch == epoch:
|
elif previous_epoch == epoch:
|
||||||
|
@ -61,7 +61,7 @@ def add_mock_attestations(spec, state, epoch, source, target, sufficient_support
|
||||||
aggregation_bits[i] = 0
|
aggregation_bits[i] = 0
|
||||||
|
|
||||||
# Update state
|
# Update state
|
||||||
if not is_post_lightclient_patch(spec):
|
if not is_post_altair(spec):
|
||||||
attestations.append(spec.PendingAttestation(
|
attestations.append(spec.PendingAttestation(
|
||||||
aggregation_bits=aggregation_bits,
|
aggregation_bits=aggregation_bits,
|
||||||
data=spec.AttestationData(
|
data=spec.AttestationData(
|
||||||
|
|
|
@ -5,7 +5,7 @@ from eth2spec.test.context import (
|
||||||
with_custom_state,
|
with_custom_state,
|
||||||
zero_activation_threshold,
|
zero_activation_threshold,
|
||||||
misc_balances, low_single_balance,
|
misc_balances, low_single_balance,
|
||||||
is_post_lightclient_patch,
|
is_post_altair,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.state import (
|
from eth2spec.test.helpers.state import (
|
||||||
next_epoch,
|
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)
|
attestations = prepare_state_with_attestations(spec, state, participation_fn=participation_tracker)
|
||||||
pre_state = state.copy()
|
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]
|
proposer_indices = [a.proposer_index for a in state.previous_epoch_attestations]
|
||||||
else:
|
else:
|
||||||
sync_committee_indices = spec.get_sync_committee_indices(state, spec.get_current_epoch(state))
|
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)):
|
for index in range(len(pre_state.validators)):
|
||||||
if spec.is_in_inactivity_leak(state):
|
if spec.is_in_inactivity_leak(state):
|
||||||
# Proposers can still make money during a leak before LIGHTCLIENT_PATCH
|
# Proposers can still make money during a leak before ALTAIR
|
||||||
if not is_post_lightclient_patch(spec) and index in proposer_indices and index in participated:
|
if not is_post_altair(spec) and index in proposer_indices and index in participated:
|
||||||
assert state.balances[index] > pre_state.balances[index]
|
assert state.balances[index] > pre_state.balances[index]
|
||||||
elif index in attesting_indices:
|
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
|
# The sync committee reward has not been canceled, so the sync committee participants still earn it
|
||||||
assert state.balances[index] >= pre_state.balances[index]
|
assert state.balances[index] >= pre_state.balances[index]
|
||||||
else:
|
else:
|
||||||
|
@ -428,7 +428,7 @@ def test_attestations_some_slashed(spec, state):
|
||||||
for i in range(spec.MIN_PER_EPOCH_CHURN_LIMIT):
|
for i in range(spec.MIN_PER_EPOCH_CHURN_LIMIT):
|
||||||
spec.slash_validator(state, attesting_indices_before_slashings[i])
|
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)
|
assert len(state.previous_epoch_attestations) == len(attestations)
|
||||||
|
|
||||||
pre_state = state.copy()
|
pre_state = state.copy()
|
||||||
|
|
|
@ -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 (
|
from eth2spec.test.helpers.epoch_processing import (
|
||||||
run_epoch_processing_with, run_epoch_processing_to
|
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):
|
def get_slashing_multiplier(spec):
|
||||||
if is_post_lightclient_patch(spec):
|
if is_post_altair(spec):
|
||||||
return spec.HF1_PROPORTIONAL_SLASHING_MULTIPLIER
|
return spec.ALTAIR_PROPORTIONAL_SLASHING_MULTIPLIER
|
||||||
else:
|
else:
|
||||||
return spec.PROPORTIONAL_SLASHING_MULTIPLIER
|
return spec.PROPORTIONAL_SLASHING_MULTIPLIER
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ from eth2spec.test.context import (
|
||||||
with_configs,
|
with_configs,
|
||||||
with_custom_state,
|
with_custom_state,
|
||||||
large_validator_set,
|
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
|
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)
|
pre_current_attestations_len = len(state.current_epoch_attestations)
|
||||||
|
|
||||||
# Add to state via block transition
|
# Add to state via block transition
|
||||||
attestation_block.body.attestations.append(attestation)
|
attestation_block.body.attestations.append(attestation)
|
||||||
signed_attestation_block = state_transition_and_sign_block(spec, state, attestation_block)
|
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
|
assert len(state.current_epoch_attestations) == pre_current_attestations_len + 1
|
||||||
# Epoch transition should move to previous_epoch_attestations
|
# Epoch transition should move to previous_epoch_attestations
|
||||||
pre_current_attestations_root = spec.hash_tree_root(state.current_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 'blocks', [signed_attestation_block, signed_epoch_block]
|
||||||
yield 'post', state
|
yield 'post', state
|
||||||
|
|
||||||
if not is_post_lightclient_patch(spec):
|
if not is_post_altair(spec):
|
||||||
assert len(state.current_epoch_attestations) == 0
|
assert len(state.current_epoch_attestations) == 0
|
||||||
assert spec.hash_tree_root(state.previous_epoch_attestations) == pre_current_attestations_root
|
assert spec.hash_tree_root(state.previous_epoch_attestations) == pre_current_attestations_root
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -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.block import build_empty_block_for_next_slot
|
||||||
from eth2spec.test.helpers.attestations import get_valid_attestation, sign_attestation
|
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
|
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)
|
spec.on_attestation(store, attestation)
|
||||||
|
|
||||||
sample_index = indexed_attestation.attesting_indices[0]
|
sample_index = indexed_attestation.attesting_indices[0]
|
||||||
if spec.fork in (PHASE0, LIGHTCLIENT_PATCH):
|
if spec.fork in (PHASE0, ALTAIR):
|
||||||
latest_message = spec.LatestMessage(
|
latest_message = spec.LatestMessage(
|
||||||
epoch=attestation.data.target.epoch,
|
epoch=attestation.data.target.epoch,
|
||||||
root=attestation.data.beacon_block_root,
|
root=attestation.data.beacon_block_root,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
always_bls,
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
def test_on_time_success(spec, state):
|
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)
|
yield from run_attestation_processing(spec, state, attestation)
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
def test_late_success(spec, state):
|
def test_late_success(spec, state):
|
||||||
|
|
|
@ -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.helpers.state import transition_to, transition_to_valid_shard_slot
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
MINIMAL,
|
MINIMAL,
|
||||||
expect_assertion_error,
|
expect_assertion_error,
|
||||||
disable_process_reveal_deadlines,
|
disable_process_reveal_deadlines,
|
||||||
|
@ -69,7 +69,7 @@ def run_custody_chunk_response_processing(spec, state, custody_response, valid=T
|
||||||
yield 'post', state
|
yield 'post', state
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@with_configs([MINIMAL], reason="too slow")
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
|
@ -93,7 +93,7 @@ def test_challenge_appended(spec, state):
|
||||||
yield from run_chunk_challenge_processing(spec, state, challenge)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@with_configs([MINIMAL], reason="too slow")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from eth2spec.test.helpers.custody import get_valid_custody_key_reveal
|
from eth2spec.test.helpers.custody import get_valid_custody_key_reveal
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
expect_assertion_error,
|
expect_assertion_error,
|
||||||
|
@ -40,7 +40,7 @@ def run_custody_key_reveal_processing(spec, state, custody_key_reveal, valid=Tru
|
||||||
yield 'post', state
|
yield 'post', state
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
def test_success(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
def test_reveal_too_early(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
def test_wrong_period(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
def test_late_reveal(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
def test_double_reveal(spec, state):
|
def test_double_reveal(spec, state):
|
||||||
|
|
|
@ -11,7 +11,7 @@ from eth2spec.test.helpers.state import get_balance, transition_to
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
MINIMAL,
|
MINIMAL,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
expect_assertion_error,
|
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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@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)
|
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
|
@spec_state_test
|
||||||
@disable_process_reveal_deadlines
|
@disable_process_reveal_deadlines
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@with_configs([MINIMAL], reason="too slow")
|
||||||
|
|
|
@ -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.helpers.state import next_epoch_via_block, get_balance
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
expect_assertion_error,
|
expect_assertion_error,
|
||||||
|
@ -42,7 +42,7 @@ def run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, v
|
||||||
yield 'post', state
|
yield 'post', state
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
def test_success(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@never_bls
|
@never_bls
|
||||||
def test_reveal_from_current_epoch(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@never_bls
|
@never_bls
|
||||||
def test_reveal_from_past_epoch(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
def test_reveal_with_custody_padding(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
def test_reveal_with_custody_padding_minus_one(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@never_bls
|
@never_bls
|
||||||
def test_double_reveal(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@never_bls
|
@never_bls
|
||||||
def test_revealer_is_slashed(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@never_bls
|
@never_bls
|
||||||
def test_far_future_epoch(spec, state):
|
def test_far_future_epoch(spec, state):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
only_full_crosslink,
|
only_full_crosslink,
|
||||||
spec_state_test,
|
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
|
assert bool(pending_attestation.crosslink_success) is True
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_basic_crosslinks(spec, state):
|
def test_basic_crosslinks(spec, state):
|
||||||
yield from run_successful_crosslink_tests(spec, state, target_len_offset_slot=1)
|
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
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_multiple_offset_slots(spec, state):
|
def test_multiple_offset_slots(spec, state):
|
||||||
yield from run_successful_crosslink_tests(spec, state, target_len_offset_slot=2)
|
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
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_no_winning_root(spec, state):
|
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
|
assert state.shard_states == pre_shard_states
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_wrong_shard_transition_root(spec, state):
|
def test_wrong_shard_transition_root(spec, state):
|
||||||
|
|
|
@ -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.helpers.state import transition_to, transition_to_valid_shard_slot
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
MINIMAL,
|
MINIMAL,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
with_all_phases_except,
|
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')
|
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
|
@spec_state_test
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@with_configs([MINIMAL], reason="too slow")
|
||||||
def test_validator_slashed_after_chunk_challenge(spec, state):
|
def test_validator_slashed_after_chunk_challenge(spec, state):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.custody import (
|
from eth2spec.test.helpers.custody import (
|
||||||
get_valid_chunk_challenge,
|
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')
|
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
|
@spec_state_test
|
||||||
def test_validator_withdrawal_delay(spec, state):
|
def test_validator_withdrawal_delay(spec, state):
|
||||||
transition_to_valid_shard_slot(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
|
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
|
@spec_state_test
|
||||||
def test_validator_withdrawal_reenable_after_custody_reveal(spec, state):
|
def test_validator_withdrawal_reenable_after_custody_reveal(spec, state):
|
||||||
transition_to_valid_shard_slot(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
|
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
|
@spec_state_test
|
||||||
def test_validator_withdrawal_suspend_after_chunk_challenge(spec, state):
|
def test_validator_withdrawal_suspend_after_chunk_challenge(spec, state):
|
||||||
transition_to_valid_shard_slot(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
|
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
|
@spec_state_test
|
||||||
def test_validator_withdrawal_resume_after_chunk_challenge_response(spec, state):
|
def test_validator_withdrawal_resume_after_chunk_challenge_response(spec, state):
|
||||||
transition_to_valid_shard_slot(spec, state)
|
transition_to_valid_shard_slot(spec, state)
|
||||||
|
|
|
@ -4,7 +4,7 @@ from eth2spec.test.helpers.custody import (
|
||||||
from eth2spec.test.helpers.state import transition_to
|
from eth2spec.test.helpers.state import transition_to
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
MINIMAL,
|
MINIMAL,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
with_configs,
|
with_configs,
|
||||||
|
@ -18,7 +18,7 @@ def run_process_challenge_deadlines(spec, state):
|
||||||
yield from run_epoch_processing_with(spec, state, 'process_challenge_deadlines')
|
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
|
@spec_state_test
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@with_configs([MINIMAL], reason="too slow")
|
||||||
def test_validator_slashed_after_reveal_deadline(spec, state):
|
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
|
assert state.validators[0].slashed == 1
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@with_configs([MINIMAL], reason="too slow")
|
@with_configs([MINIMAL], reason="too slow")
|
||||||
def test_validator_not_slashed_after_reveal(spec, state):
|
def test_validator_not_slashed_after_reveal(spec, state):
|
||||||
|
|
|
@ -2,7 +2,7 @@ from typing import Dict, Sequence
|
||||||
|
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
MINIMAL,
|
MINIMAL,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
spec_state_test,
|
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
|
assert post_shard_state.gasprice > pre_gasprice
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_process_beacon_block_with_normal_shard_transition(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_process_beacon_block_with_empty_proposal_transition(spec, state):
|
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
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_with_shard_transition_with_custody_challenge_and_response(spec, state):
|
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)
|
yield from run_beacon_block(spec, state, block)
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@with_configs([MINIMAL])
|
@with_configs([MINIMAL])
|
||||||
def test_custody_key_reveal(spec, state):
|
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)
|
yield from run_beacon_block(spec, state, block)
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_early_derived_secret_reveal(spec, state):
|
def test_early_derived_secret_reveal(spec, state):
|
||||||
transition_to_valid_shard_slot(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)
|
yield from run_beacon_block(spec, state, block)
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_custody_slashing(spec, state):
|
def test_custody_slashing(spec, state):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
always_bls,
|
always_bls,
|
||||||
expect_assertion_error,
|
expect_assertion_error,
|
||||||
spec_state_test,
|
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
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
@only_full_crosslink
|
@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
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_invalid_shard_parent_root(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_invalid_beacon_parent_root(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_invalid_slot(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_invalid_proposer_index(spec, state):
|
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)
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
@only_full_crosslink
|
@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)
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
@only_full_crosslink
|
@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)
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
@only_full_crosslink
|
@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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
@only_full_crosslink
|
@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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
@only_full_crosslink
|
@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)
|
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
|
@spec_state_test
|
||||||
@always_bls
|
@always_bls
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
|
|
|
@ -2,7 +2,7 @@ from eth2spec.utils.ssz.ssz_impl import hash_tree_root
|
||||||
|
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
never_bls,
|
never_bls,
|
||||||
|
@ -152,7 +152,7 @@ def create_and_apply_beacon_and_shard_blocks(spec, state, store, shard, shard_bl
|
||||||
return has_shard_committee
|
return has_shard_committee
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@never_bls # Set to never_bls for testing `check_pending_shard_blocks`
|
@never_bls # Set to never_bls for testing `check_pending_shard_blocks`
|
||||||
def test_basic(spec, state):
|
def test_basic(spec, state):
|
||||||
|
@ -213,7 +213,7 @@ def create_simple_fork(spec, state, store, shard):
|
||||||
return head_block, forking_block
|
return head_block, forking_block
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_shard_simple_fork(spec, state):
|
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()
|
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
|
@spec_state_test
|
||||||
@only_full_crosslink
|
@only_full_crosslink
|
||||||
def test_shard_latest_messages_for_different_shards(spec, state):
|
def test_shard_latest_messages_for_different_shards(spec, state):
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
PHASE0,
|
||||||
LIGHTCLIENT_PATCH,
|
ALTAIR,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.state import next_epoch
|
from eth2spec.test.helpers.state import next_epoch
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_get_committee_count_delta(spec, state):
|
def test_get_committee_count_delta(spec, state):
|
||||||
assert spec.get_committee_count_delta(state, 0, 0) == 0
|
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
|
@spec_state_test
|
||||||
def test_get_start_shard_current_epoch_start(spec, state):
|
def test_get_start_shard_current_epoch_start(spec, state):
|
||||||
assert state.current_epoch_start_shard == 0
|
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
|
assert start_shard == state.current_epoch_start_shard
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_get_start_shard_next_slot(spec, state):
|
def test_get_start_shard_next_slot(spec, state):
|
||||||
next_epoch(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
|
assert start_shard == expected_start_shard
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_get_start_shard_previous_slot(spec, state):
|
def test_get_start_shard_previous_slot(spec, state):
|
||||||
next_epoch(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
|
assert start_shard == expected_start_shard
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases_except([PHASE0, LIGHTCLIENT_PATCH])
|
@with_all_phases_except([PHASE0, ALTAIR])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_get_start_shard_far_past_epoch(spec, state):
|
def test_get_start_shard_far_past_epoch(spec, state):
|
||||||
initial_epoch = spec.get_current_epoch(state)
|
initial_epoch = spec.get_current_epoch(state)
|
||||||
|
|
|
@ -22,7 +22,7 @@ Key of valid `fork` strings that might be found in `meta.yaml`
|
||||||
|
|
||||||
| String ID | Pre-fork | Post-fork | Function |
|
| 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`
|
### `pre.ssz_snappy`
|
||||||
|
|
||||||
|
|
|
@ -163,14 +163,14 @@ Another example, to generate tests from pytests:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from eth2spec.phase0 import spec as spec_phase0
|
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.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
|
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__":
|
if __name__ == "__main__":
|
||||||
|
@ -178,7 +178,7 @@ if __name__ == "__main__":
|
||||||
'blocks',
|
'blocks',
|
||||||
'slots',
|
'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',
|
'blocks',
|
||||||
]}, **phase_0_mods} # also run the previous phase 0 tests
|
]}, **phase_0_mods} # also run the previous phase 0 tests
|
||||||
phase_1_mods = {**{key: 'eth2spec.test.phase1.sanity.test_' + key for key in [
|
phase_1_mods = {**{key: 'eth2spec.test.phase1.sanity.test_' + key for key in [
|
||||||
|
@ -188,7 +188,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
all_mods = {
|
all_mods = {
|
||||||
PHASE0: phase_0_mods,
|
PHASE0: phase_0_mods,
|
||||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
ALTAIR: altair_mods,
|
||||||
PHASE1: phase_1_mods,
|
PHASE1: phase_1_mods,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||||
from eth2spec.phase0 import spec as spec_phase0
|
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.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__":
|
if __name__ == "__main__":
|
||||||
|
@ -21,8 +21,8 @@ if __name__ == "__main__":
|
||||||
'historical_roots_update',
|
'historical_roots_update',
|
||||||
'participation_record_updates',
|
'participation_record_updates',
|
||||||
]}
|
]}
|
||||||
lightclient_patch_mods = {
|
altair_mods = {
|
||||||
**{key: 'eth2spec.test.lightclient_patch.epoch_processing.test_process_' + key for key in [
|
**{key: 'eth2spec.test.altair.epoch_processing.test_process_' + key for key in [
|
||||||
'sync_committee_updates',
|
'sync_committee_updates',
|
||||||
]},
|
]},
|
||||||
**phase_0_mods,
|
**phase_0_mods,
|
||||||
|
@ -35,7 +35,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
all_mods = {
|
all_mods = {
|
||||||
PHASE0: phase_0_mods,
|
PHASE0: phase_0_mods,
|
||||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
ALTAIR: altair_mods,
|
||||||
PHASE1: phase_1_mods,
|
PHASE1: phase_1_mods,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||||
from eth2spec.phase0 import spec as spec_phase0
|
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.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__":
|
if __name__ == "__main__":
|
||||||
phase_0_mods = {'finality': 'eth2spec.test.phase0.finality.test_finality'}
|
phase_0_mods = {'finality': 'eth2spec.test.phase0.finality.test_finality'}
|
||||||
# No additional lightclient_patch or phase 1 specific finality tests, yet.
|
# No additional altair or phase 1 specific finality tests, yet.
|
||||||
lightclient_patch_mods = phase_0_mods
|
altair_mods = phase_0_mods
|
||||||
phase_1_mods = phase_0_mods
|
phase_1_mods = phase_0_mods
|
||||||
|
|
||||||
all_mods = {
|
all_mods = {
|
||||||
PHASE0: phase_0_mods,
|
PHASE0: phase_0_mods,
|
||||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
ALTAIR: altair_mods,
|
||||||
PHASE1: phase_1_mods,
|
PHASE1: phase_1_mods,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from importlib import reload
|
from importlib import reload
|
||||||
from typing import Iterable
|
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.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.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_base import gen_runner, gen_typing
|
||||||
from eth2spec.gen_helpers.gen_from_tests.gen import generate_from_tests
|
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:
|
def prepare_fn(configs_path: str) -> str:
|
||||||
config_util.prepare_config(configs_path, config_name)
|
config_util.prepare_config(configs_path, config_name)
|
||||||
reload(spec_phase0)
|
reload(spec_phase0)
|
||||||
reload(spec_lightclient_patch)
|
reload(spec_altair)
|
||||||
return config_name
|
return config_name
|
||||||
|
|
||||||
def cases_fn() -> Iterable[gen_typing.TestCase]:
|
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__":
|
if __name__ == "__main__":
|
||||||
gen_runner.run_generator("forks", [
|
gen_runner.run_generator("forks", [
|
||||||
create_provider(test_altair_forks, MINIMAL, PHASE0, LIGHTCLIENT_PATCH),
|
create_provider(test_altair_forks, MINIMAL, PHASE0, ALTAIR),
|
||||||
create_provider(test_altair_forks, MAINNET, PHASE0, LIGHTCLIENT_PATCH),
|
create_provider(test_altair_forks, MAINNET, PHASE0, ALTAIR),
|
||||||
])
|
])
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||||
from eth2spec.phase0 import spec as spec_phase0
|
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.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__":
|
if __name__ == "__main__":
|
||||||
|
@ -17,8 +17,8 @@ if __name__ == "__main__":
|
||||||
'proposer_slashing',
|
'proposer_slashing',
|
||||||
'voluntary_exit',
|
'voluntary_exit',
|
||||||
]}
|
]}
|
||||||
lightclient_patch_mods = {
|
altair_mods = {
|
||||||
**{key: 'eth2spec.test.lightclient_patch.block_processing.test_process_' + key for key in [
|
**{key: 'eth2spec.test.altair.block_processing.test_process_' + key for key in [
|
||||||
'sync_committee',
|
'sync_committee',
|
||||||
]},
|
]},
|
||||||
**phase_0_mods,
|
**phase_0_mods,
|
||||||
|
@ -34,7 +34,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
all_mods = {
|
all_mods = {
|
||||||
PHASE0: phase_0_mods,
|
PHASE0: phase_0_mods,
|
||||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
ALTAIR: altair_mods,
|
||||||
PHASE1: phase_1_mods,
|
PHASE1: phase_1_mods,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||||
from eth2spec.phase0 import spec as spec_phase0
|
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.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__":
|
if __name__ == "__main__":
|
||||||
|
@ -14,13 +14,13 @@ if __name__ == "__main__":
|
||||||
'leak',
|
'leak',
|
||||||
'random',
|
'random',
|
||||||
]}
|
]}
|
||||||
# No additional lightclient_patch or phase 1 specific rewards tests, yet.
|
# No additional altair or phase 1 specific rewards tests, yet.
|
||||||
lightclient_patch_mods = phase_0_mods
|
altair_mods = phase_0_mods
|
||||||
phase_1_mods = phase_0_mods
|
phase_1_mods = phase_0_mods
|
||||||
|
|
||||||
all_mods = {
|
all_mods = {
|
||||||
PHASE0: phase_0_mods,
|
PHASE0: phase_0_mods,
|
||||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
ALTAIR: altair_mods,
|
||||||
PHASE1: phase_1_mods,
|
PHASE1: phase_1_mods,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
from eth2spec.phase0 import spec as spec_phase0
|
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.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
|
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__":
|
if __name__ == "__main__":
|
||||||
|
@ -14,7 +14,7 @@ if __name__ == "__main__":
|
||||||
'blocks',
|
'blocks',
|
||||||
'slots',
|
'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',
|
'blocks',
|
||||||
]}, **phase_0_mods} # also run the previous phase 0 tests
|
]}, **phase_0_mods} # also run the previous phase 0 tests
|
||||||
phase_1_mods = {**{key: 'eth2spec.test.phase1.sanity.test_' + key for key in [
|
phase_1_mods = {**{key: 'eth2spec.test.phase1.sanity.test_' + key for key in [
|
||||||
|
@ -24,7 +24,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
all_mods = {
|
all_mods = {
|
||||||
PHASE0: phase_0_mods,
|
PHASE0: phase_0_mods,
|
||||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
ALTAIR: altair_mods,
|
||||||
PHASE1: phase_1_mods,
|
PHASE1: phase_1_mods,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ from eth2spec.debug import random_value, encode
|
||||||
from eth2spec.config import config_util
|
from eth2spec.config import config_util
|
||||||
from eth2spec.phase0 import spec as spec_phase0
|
from eth2spec.phase0 import spec as spec_phase0
|
||||||
from eth2spec.phase1 import spec as spec_phase1
|
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.test.context import PHASE1, LIGHTCLIENT_PATCH, TESTGEN_FORKS, MINIMAL, MAINNET
|
from eth2spec.test.context import PHASE1, ALTAIR, TESTGEN_FORKS, MINIMAL, MAINNET
|
||||||
from eth2spec.utils.ssz.ssz_typing import Container
|
from eth2spec.utils.ssz.ssz_typing import Container
|
||||||
from eth2spec.utils.ssz.ssz_impl import (
|
from eth2spec.utils.ssz.ssz_impl import (
|
||||||
hash_tree_root,
|
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)
|
config_util.prepare_config(configs_path, config_name)
|
||||||
reload(spec_phase0)
|
reload(spec_phase0)
|
||||||
reload(spec_phase1)
|
reload(spec_phase1)
|
||||||
reload(spec_lightclient_patch)
|
reload(spec_altair)
|
||||||
return config_name
|
return config_name
|
||||||
|
|
||||||
def cases_fn() -> Iterable[gen_typing.TestCase]:
|
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
|
spec = spec_phase0
|
||||||
if fork_name == PHASE1:
|
if fork_name == PHASE1:
|
||||||
spec = spec_phase1
|
spec = spec_phase1
|
||||||
if fork_name == LIGHTCLIENT_PATCH:
|
if fork_name == ALTAIR:
|
||||||
spec = spec_lightclient_patch
|
spec = spec_altair
|
||||||
|
|
||||||
for (i, (name, ssz_type)) in enumerate(get_spec_ssz_types(spec)):
|
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)
|
yield from ssz_static_cases(fork_name, seed * 1000 + i, name, ssz_type, mode, chaos, count)
|
||||||
|
|
Loading…
Reference in New Issue