Rename `phases.py` to `forks.py`; add `ValueError` check

Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
This commit is contained in:
Etan Kissling 2022-11-10 13:26:00 +01:00
parent 99785733b7
commit 76157f91d7
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
21 changed files with 21 additions and 21 deletions

View File

@ -5,7 +5,7 @@ from eth2spec.test.context import (
with_phases,
)
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,
)

View File

@ -16,7 +16,7 @@ from .helpers.constants import (
ALL_PHASES,
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.genesis import create_genesis_state
from .utils import (

View File

@ -5,8 +5,8 @@ from typing import List
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.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.phases import is_post_altair
from eth2spec.utils import bls
from eth2spec.utils.ssz.ssz_typing import Bitlist

View File

@ -1,6 +1,6 @@
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.phases import is_post_altair, is_post_bellatrix
from eth2spec.utils import bls
from eth2spec.utils.bls import only_with_bls
from eth2spec.utils.ssz.ssz_impl import hash_tree_root

View File

@ -1,8 +1,8 @@
from random import Random
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.phases import is_post_altair
from eth2spec.test.helpers.state import get_balance
from eth2spec.utils import bls
from eth2spec.utils.merkle_minimal import calc_merkle_tree_from_leaves, get_merkle_proof

View File

@ -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):

View File

@ -1,5 +1,5 @@
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):

View File

@ -14,7 +14,7 @@ def is_post_fork(a, b):
return b in [PHASE0, ALTAIR]
if a == PHASE0:
return b in [PHASE0]
assert False # Fork is missing
raise ValueError("Unknown fork name %s" % a)
def is_post_altair(spec):

View File

@ -1,7 +1,7 @@
from eth2spec.test.helpers.constants import (
ALTAIR, BELLATRIX, CAPELLA, EIP4844,
)
from eth2spec.test.helpers.phases import (
from eth2spec.test.helpers.forks import (
is_post_altair, is_post_bellatrix,
)
from eth2spec.test.helpers.keys import pubkeys

View File

@ -1,6 +1,6 @@
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.phases import is_post_altair, is_post_bellatrix
from eth2spec.test.helpers.state import get_balance
from eth2spec.test.helpers.sync_committee import (
compute_committee_indices,

View File

@ -2,7 +2,7 @@ from random import Random
from eth2spec.test.helpers.attestations import cached_prepare_state_with_attestations
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

View File

@ -2,7 +2,7 @@ from random import Random
from lru import LRU
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 (
next_epoch,
)

View File

@ -1,6 +1,6 @@
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.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

View File

@ -3,7 +3,7 @@ from eth2spec.test.context import spec_state_test, with_all_phases
from eth2spec.test.helpers.epoch_processing import (
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.voluntary_exits import get_unslashed_exited_validators

View File

@ -6,7 +6,7 @@ from eth2spec.test.context import (
zero_activation_threshold,
misc_balances, low_single_balance,
)
from eth2spec.test.helpers.phases import (
from eth2spec.test.helpers.forks import (
is_post_altair,
)
from eth2spec.test.helpers.state import (

View File

@ -3,8 +3,8 @@ from eth2spec.test.context import spec_state_test, with_all_phases
from eth2spec.test.helpers.epoch_processing import (
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.phases import is_post_altair, is_post_bellatrix
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.state import next_epoch

View File

@ -23,7 +23,7 @@ from eth2spec.test.helpers.fork_choice import (
tick_and_run_on_attestation,
tick_and_add_block,
)
from eth2spec.test.helpers.phases import (
from eth2spec.test.helpers.forks import (
is_post_altair,
)
from eth2spec.test.helpers.state import (

View File

@ -9,7 +9,7 @@ from eth2spec.test.helpers.deposits import (
prepare_full_genesis_deposits,
prepare_random_genesis_deposits,
)
from eth2spec.test.helpers.phases import (
from eth2spec.test.helpers.forks import (
is_post_altair,
)

View File

@ -8,7 +8,7 @@ from eth2spec.test.helpers.constants import MINIMAL
from eth2spec.test.helpers.deposits import (
prepare_full_genesis_deposits,
)
from eth2spec.test.helpers.phases import (
from eth2spec.test.helpers.forks import (
is_post_altair,
)

View File

@ -30,7 +30,7 @@ from eth2spec.test.helpers.sync_committee import (
compute_sync_committee_participant_reward_and_penalty,
)
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 (
spec_test, spec_state_test, dump_skipping_message,
with_phases, with_all_phases, single_phase,

View File

@ -3,7 +3,7 @@ from eth2spec.test.context import (
with_all_phases,
)
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,
)