Rename `phases.py` to `forks.py`; add `ValueError` check
Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
This commit is contained in:
parent
99785733b7
commit
76157f91d7
|
@ -5,7 +5,7 @@ from eth2spec.test.context import (
|
||||||
with_phases,
|
with_phases,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.constants import ALTAIR
|
from eth2spec.test.helpers.constants import ALTAIR
|
||||||
from eth2spec.test.helpers.phases import (
|
from eth2spec.test.helpers.forks import (
|
||||||
is_post_capella, is_post_eip4844,
|
is_post_capella, is_post_eip4844,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ from .helpers.constants import (
|
||||||
ALL_PHASES,
|
ALL_PHASES,
|
||||||
ALL_FORK_UPGRADES,
|
ALL_FORK_UPGRADES,
|
||||||
)
|
)
|
||||||
from .helpers.phases import is_post_fork
|
from .helpers.forks import is_post_fork
|
||||||
from .helpers.typing import SpecForkName, PresetBaseName
|
from .helpers.typing import SpecForkName, PresetBaseName
|
||||||
from .helpers.genesis import create_genesis_state
|
from .helpers.genesis import create_genesis_state
|
||||||
from .utils import (
|
from .utils import (
|
||||||
|
|
|
@ -5,8 +5,8 @@ from typing import List
|
||||||
from eth2spec.test.context import expect_assertion_error
|
from eth2spec.test.context import expect_assertion_error
|
||||||
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.forks import is_post_altair
|
||||||
from eth2spec.test.helpers.keys import privkeys
|
from eth2spec.test.helpers.keys import privkeys
|
||||||
from eth2spec.test.helpers.phases import is_post_altair
|
|
||||||
from eth2spec.utils import bls
|
from eth2spec.utils import bls
|
||||||
from eth2spec.utils.ssz.ssz_typing import Bitlist
|
from eth2spec.utils.ssz.ssz_typing import Bitlist
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from eth2spec.test.helpers.execution_payload import build_empty_execution_payload
|
from eth2spec.test.helpers.execution_payload import build_empty_execution_payload
|
||||||
|
from eth2spec.test.helpers.forks import is_post_altair, is_post_bellatrix
|
||||||
from eth2spec.test.helpers.keys import privkeys
|
from eth2spec.test.helpers.keys import privkeys
|
||||||
from eth2spec.test.helpers.phases import is_post_altair, is_post_bellatrix
|
|
||||||
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
|
||||||
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
|
from eth2spec.utils.ssz.ssz_impl import hash_tree_root
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from random import Random
|
from random import Random
|
||||||
|
|
||||||
from eth2spec.test.context import expect_assertion_error
|
from eth2spec.test.context import expect_assertion_error
|
||||||
|
from eth2spec.test.helpers.forks import is_post_altair
|
||||||
from eth2spec.test.helpers.keys import pubkeys, privkeys
|
from eth2spec.test.helpers.keys import pubkeys, privkeys
|
||||||
from eth2spec.test.helpers.phases import is_post_altair
|
|
||||||
from eth2spec.test.helpers.state import get_balance
|
from eth2spec.test.helpers.state import get_balance
|
||||||
from eth2spec.utils import bls
|
from eth2spec.utils import bls
|
||||||
from eth2spec.utils.merkle_minimal import calc_merkle_tree_from_leaves, get_merkle_proof
|
from eth2spec.utils.merkle_minimal import calc_merkle_tree_from_leaves, get_merkle_proof
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
from eth2spec.test.helpers.phases import is_post_altair
|
from eth2spec.test.helpers.forks import is_post_altair
|
||||||
|
|
||||||
|
|
||||||
def get_process_calls(spec):
|
def get_process_calls(spec):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from eth2spec.debug.random_value import get_random_bytes_list
|
from eth2spec.debug.random_value import get_random_bytes_list
|
||||||
from eth2spec.test.helpers.phases import is_post_capella
|
from eth2spec.test.helpers.forks import is_post_capella
|
||||||
|
|
||||||
|
|
||||||
def build_empty_execution_payload(spec, state, randao_mix=None):
|
def build_empty_execution_payload(spec, state, randao_mix=None):
|
||||||
|
|
|
@ -14,7 +14,7 @@ def is_post_fork(a, b):
|
||||||
return b in [PHASE0, ALTAIR]
|
return b in [PHASE0, ALTAIR]
|
||||||
if a == PHASE0:
|
if a == PHASE0:
|
||||||
return b in [PHASE0]
|
return b in [PHASE0]
|
||||||
assert False # Fork is missing
|
raise ValueError("Unknown fork name %s" % a)
|
||||||
|
|
||||||
|
|
||||||
def is_post_altair(spec):
|
def is_post_altair(spec):
|
|
@ -1,7 +1,7 @@
|
||||||
from eth2spec.test.helpers.constants import (
|
from eth2spec.test.helpers.constants import (
|
||||||
ALTAIR, BELLATRIX, CAPELLA, EIP4844,
|
ALTAIR, BELLATRIX, CAPELLA, EIP4844,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.phases import (
|
from eth2spec.test.helpers.forks import (
|
||||||
is_post_altair, is_post_bellatrix,
|
is_post_altair, is_post_bellatrix,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.keys import pubkeys
|
from eth2spec.test.helpers.keys import pubkeys
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from eth2spec.test.helpers.block_header import sign_block_header
|
from eth2spec.test.helpers.block_header import sign_block_header
|
||||||
|
from eth2spec.test.helpers.forks import is_post_altair, is_post_bellatrix
|
||||||
from eth2spec.test.helpers.keys import pubkey_to_privkey
|
from eth2spec.test.helpers.keys import pubkey_to_privkey
|
||||||
from eth2spec.test.helpers.phases import is_post_altair, is_post_bellatrix
|
|
||||||
from eth2spec.test.helpers.state import get_balance
|
from eth2spec.test.helpers.state import get_balance
|
||||||
from eth2spec.test.helpers.sync_committee import (
|
from eth2spec.test.helpers.sync_committee import (
|
||||||
compute_committee_indices,
|
compute_committee_indices,
|
||||||
|
|
|
@ -2,7 +2,7 @@ from random import Random
|
||||||
|
|
||||||
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.phases import is_post_altair
|
from eth2spec.test.helpers.forks import is_post_altair
|
||||||
from eth2spec.test.helpers.state import next_epoch
|
from eth2spec.test.helpers.state import next_epoch
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ from random import Random
|
||||||
from lru import LRU
|
from lru import LRU
|
||||||
|
|
||||||
from eth2spec.phase0.mainnet import VALIDATOR_REGISTRY_LIMIT # equal everywhere, fine to import
|
from eth2spec.phase0.mainnet import VALIDATOR_REGISTRY_LIMIT # equal everywhere, fine to import
|
||||||
from eth2spec.test.helpers.phases import is_post_altair, is_post_bellatrix
|
from eth2spec.test.helpers.forks import is_post_altair, is_post_bellatrix
|
||||||
from eth2spec.test.helpers.state import (
|
from eth2spec.test.helpers.state import (
|
||||||
next_epoch,
|
next_epoch,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from eth2spec.test.context import expect_assertion_error
|
from eth2spec.test.context import expect_assertion_error
|
||||||
from eth2spec.test.helpers.block import apply_empty_block, sign_block, transition_unsigned_block
|
from eth2spec.test.helpers.block import apply_empty_block, sign_block, transition_unsigned_block
|
||||||
from eth2spec.test.helpers.phases import is_post_altair
|
from eth2spec.test.helpers.forks import is_post_altair
|
||||||
from eth2spec.test.helpers.voluntary_exits import get_unslashed_exited_validators
|
from eth2spec.test.helpers.voluntary_exits import get_unslashed_exited_validators
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ from eth2spec.test.context import 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,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.phases import is_post_altair
|
from eth2spec.test.helpers.forks import is_post_altair
|
||||||
from eth2spec.test.helpers.state import transition_to, next_epoch_via_block, next_slot
|
from eth2spec.test.helpers.state import transition_to, next_epoch_via_block, next_slot
|
||||||
from eth2spec.test.helpers.voluntary_exits import get_unslashed_exited_validators
|
from eth2spec.test.helpers.voluntary_exits import get_unslashed_exited_validators
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from eth2spec.test.context import (
|
||||||
zero_activation_threshold,
|
zero_activation_threshold,
|
||||||
misc_balances, low_single_balance,
|
misc_balances, low_single_balance,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.phases import (
|
from eth2spec.test.helpers.forks import (
|
||||||
is_post_altair,
|
is_post_altair,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.state import (
|
from eth2spec.test.helpers.state import (
|
||||||
|
|
|
@ -3,8 +3,8 @@ from eth2spec.test.context import 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_to
|
run_epoch_processing_with, run_epoch_processing_to
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.forks import is_post_altair, is_post_bellatrix
|
||||||
from eth2spec.test.helpers.random import randomize_state
|
from eth2spec.test.helpers.random import randomize_state
|
||||||
from eth2spec.test.helpers.phases import is_post_altair, is_post_bellatrix
|
|
||||||
from eth2spec.test.helpers.state import has_active_balance_differential
|
from eth2spec.test.helpers.state import has_active_balance_differential
|
||||||
from eth2spec.test.helpers.voluntary_exits import get_unslashed_exited_validators
|
from eth2spec.test.helpers.voluntary_exits import get_unslashed_exited_validators
|
||||||
from eth2spec.test.helpers.state import next_epoch
|
from eth2spec.test.helpers.state import next_epoch
|
||||||
|
|
|
@ -23,7 +23,7 @@ from eth2spec.test.helpers.fork_choice import (
|
||||||
tick_and_run_on_attestation,
|
tick_and_run_on_attestation,
|
||||||
tick_and_add_block,
|
tick_and_add_block,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.phases import (
|
from eth2spec.test.helpers.forks import (
|
||||||
is_post_altair,
|
is_post_altair,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.state import (
|
from eth2spec.test.helpers.state import (
|
||||||
|
|
|
@ -9,7 +9,7 @@ from eth2spec.test.helpers.deposits import (
|
||||||
prepare_full_genesis_deposits,
|
prepare_full_genesis_deposits,
|
||||||
prepare_random_genesis_deposits,
|
prepare_random_genesis_deposits,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.phases import (
|
from eth2spec.test.helpers.forks import (
|
||||||
is_post_altair,
|
is_post_altair,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from eth2spec.test.helpers.constants import MINIMAL
|
||||||
from eth2spec.test.helpers.deposits import (
|
from eth2spec.test.helpers.deposits import (
|
||||||
prepare_full_genesis_deposits,
|
prepare_full_genesis_deposits,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.phases import (
|
from eth2spec.test.helpers.forks import (
|
||||||
is_post_altair,
|
is_post_altair,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ from eth2spec.test.helpers.sync_committee import (
|
||||||
compute_sync_committee_participant_reward_and_penalty,
|
compute_sync_committee_participant_reward_and_penalty,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.constants import PHASE0, MINIMAL
|
from eth2spec.test.helpers.constants import PHASE0, MINIMAL
|
||||||
from eth2spec.test.helpers.phases import is_post_altair, is_post_bellatrix
|
from eth2spec.test.helpers.forks import is_post_altair, is_post_bellatrix
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
spec_test, spec_state_test, dump_skipping_message,
|
spec_test, spec_state_test, dump_skipping_message,
|
||||||
with_phases, with_all_phases, single_phase,
|
with_phases, with_all_phases, single_phase,
|
||||||
|
|
|
@ -3,7 +3,7 @@ from eth2spec.test.context import (
|
||||||
with_all_phases,
|
with_all_phases,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.constants import MAX_UINT_64
|
from eth2spec.test.helpers.constants import MAX_UINT_64
|
||||||
from eth2spec.test.helpers.phases import (
|
from eth2spec.test.helpers.forks import (
|
||||||
is_post_altair, is_post_bellatrix,
|
is_post_altair, is_post_bellatrix,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue