Merge pull request #2325 from ethereum/pyspec-constants
Refactor pyspec `context.py` by adding `typing.py` and `constants.py`
This commit is contained in:
commit
1235e58a8d
|
@ -4,7 +4,8 @@ from typing import Any, Callable, Dict, Iterable, Optional
|
||||||
|
|
||||||
from eth2spec.config import config_util
|
from eth2spec.config import config_util
|
||||||
from eth2spec.utils import bls
|
from eth2spec.utils import bls
|
||||||
from eth2spec.test.context import ALL_CONFIGS, TESTGEN_FORKS, SpecForkName, ConfigName
|
from eth2spec.test.helpers.constants import ALL_CONFIGS, TESTGEN_FORKS
|
||||||
|
from eth2spec.test.helpers.typing import SpecForkName, ConfigName
|
||||||
|
|
||||||
from eth2spec.gen_helpers.gen_base import gen_runner
|
from eth2spec.gen_helpers.gen_base import gen_runner
|
||||||
from eth2spec.gen_helpers.gen_base.gen_typing import TestCase, TestProvider
|
from eth2spec.gen_helpers.gen_base.gen_typing import TestCase, TestProvider
|
||||||
|
|
|
@ -8,12 +8,14 @@ from eth2spec.test.helpers.state import (
|
||||||
state_transition_and_sign_block,
|
state_transition_and_sign_block,
|
||||||
transition_to,
|
transition_to,
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import (
|
||||||
|
PHASE0,
|
||||||
|
MAINNET, MINIMAL,
|
||||||
|
)
|
||||||
from eth2spec.test.helpers.sync_committee import (
|
from eth2spec.test.helpers.sync_committee import (
|
||||||
compute_aggregate_sync_committee_signature,
|
compute_aggregate_sync_committee_signature,
|
||||||
)
|
)
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
|
||||||
MAINNET, MINIMAL,
|
|
||||||
expect_assertion_error,
|
expect_assertion_error,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
with_configs,
|
with_configs,
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
|
||||||
MINIMAL,
|
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
with_configs,
|
with_configs,
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import (
|
||||||
|
PHASE0,
|
||||||
|
MINIMAL,
|
||||||
|
)
|
||||||
from eth2spec.test.helpers.state import transition_to
|
from eth2spec.test.helpers.state import transition_to
|
||||||
from eth2spec.test.helpers.epoch_processing import (
|
from eth2spec.test.helpers.epoch_processing import (
|
||||||
run_epoch_processing_with,
|
run_epoch_processing_with,
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0, ALTAIR,
|
|
||||||
MINIMAL,
|
|
||||||
with_phases,
|
with_phases,
|
||||||
with_custom_state,
|
with_custom_state,
|
||||||
with_configs,
|
with_configs,
|
||||||
|
@ -8,6 +6,10 @@ from eth2spec.test.context import (
|
||||||
low_balances, misc_balances, large_validator_set,
|
low_balances, misc_balances, large_validator_set,
|
||||||
)
|
)
|
||||||
from eth2spec.test.utils import with_meta_tags
|
from eth2spec.test.utils import with_meta_tags
|
||||||
|
from eth2spec.test.helpers.constants import (
|
||||||
|
PHASE0, ALTAIR,
|
||||||
|
MINIMAL,
|
||||||
|
)
|
||||||
from eth2spec.test.helpers.state import (
|
from eth2spec.test.helpers.state import (
|
||||||
next_epoch,
|
next_epoch,
|
||||||
next_epoch_via_block,
|
next_epoch_via_block,
|
||||||
|
|
|
@ -11,8 +11,8 @@ from eth2spec.test.helpers.block import (
|
||||||
from eth2spec.test.helpers.sync_committee import (
|
from eth2spec.test.helpers.sync_committee import (
|
||||||
compute_aggregate_sync_committee_signature,
|
compute_aggregate_sync_committee_signature,
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import PHASE0
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0,
|
|
||||||
with_all_phases_except,
|
with_all_phases_except,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
with_phases,
|
with_phases,
|
||||||
ALTAIR,
|
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import ALTAIR
|
||||||
from eth2spec.test.helpers.merkle import build_proof
|
from eth2spec.test.helpers.merkle import build_proof
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
ALTAIR,
|
|
||||||
MINIMAL,
|
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
with_configs,
|
with_configs,
|
||||||
with_phases,
|
with_phases,
|
||||||
|
@ -10,6 +8,10 @@ from eth2spec.test.helpers.block import (
|
||||||
build_empty_block,
|
build_empty_block,
|
||||||
build_empty_block_for_next_slot,
|
build_empty_block_for_next_slot,
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import (
|
||||||
|
ALTAIR,
|
||||||
|
MINIMAL,
|
||||||
|
)
|
||||||
from eth2spec.test.helpers.state import (
|
from eth2spec.test.helpers.state import (
|
||||||
next_slots,
|
next_slots,
|
||||||
state_transition_and_sign_block,
|
state_transition_and_sign_block,
|
||||||
|
|
|
@ -6,11 +6,15 @@ from eth2spec.merge import spec as spec_merge
|
||||||
from eth2spec.utils import bls
|
from eth2spec.utils import bls
|
||||||
|
|
||||||
from .exceptions import SkippedTest
|
from .exceptions import SkippedTest
|
||||||
|
from .helpers.constants import (
|
||||||
|
PHASE0, ALTAIR, MERGE, SHARDING, CUSTODY_GAME, DAS,
|
||||||
|
ALL_PHASES,
|
||||||
|
)
|
||||||
from .helpers.genesis import create_genesis_state
|
from .helpers.genesis import create_genesis_state
|
||||||
from .utils import vector_test, with_meta_tags
|
from .utils import vector_test, with_meta_tags
|
||||||
|
|
||||||
from random import Random
|
from random import Random
|
||||||
from typing import Any, Callable, NewType, Sequence, TypedDict, Protocol
|
from typing import Any, Callable, Sequence, TypedDict, Protocol
|
||||||
|
|
||||||
from lru import LRU
|
from lru import LRU
|
||||||
|
|
||||||
|
@ -23,30 +27,6 @@ def reload_specs():
|
||||||
reload(spec_merge)
|
reload(spec_merge)
|
||||||
|
|
||||||
|
|
||||||
# Some of the Spec module functionality is exposed here to deal with phase-specific changes.
|
|
||||||
|
|
||||||
SpecForkName = NewType("SpecForkName", str)
|
|
||||||
ConfigName = NewType("ConfigName", str)
|
|
||||||
|
|
||||||
PHASE0 = SpecForkName('phase0')
|
|
||||||
ALTAIR = SpecForkName('altair')
|
|
||||||
|
|
||||||
# Experimental phases (not included in default "ALL_PHASES"):
|
|
||||||
MERGE = SpecForkName('merge')
|
|
||||||
SHARDING = SpecForkName('sharding')
|
|
||||||
CUSTODY_GAME = SpecForkName('custody_game')
|
|
||||||
DAS = SpecForkName('das')
|
|
||||||
|
|
||||||
ALL_PHASES = (PHASE0, ALTAIR)
|
|
||||||
|
|
||||||
MAINNET = ConfigName('mainnet')
|
|
||||||
MINIMAL = ConfigName('minimal')
|
|
||||||
|
|
||||||
ALL_CONFIGS = (MINIMAL, MAINNET)
|
|
||||||
|
|
||||||
# The forks that output to the test vectors.
|
|
||||||
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.
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
CUSTODY_GAME,
|
|
||||||
with_phases,
|
with_phases,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
always_bls,
|
always_bls,
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import CUSTODY_GAME
|
||||||
from eth2spec.test.helpers.state import transition_to
|
from eth2spec.test.helpers.state import transition_to
|
||||||
from eth2spec.test.helpers.attestations import (
|
from eth2spec.test.helpers.attestations import (
|
||||||
run_attestation_processing,
|
run_attestation_processing,
|
||||||
|
|
|
@ -6,10 +6,12 @@ from eth2spec.test.helpers.custody import (
|
||||||
from eth2spec.test.helpers.attestations import (
|
from eth2spec.test.helpers.attestations import (
|
||||||
get_valid_on_time_attestation,
|
get_valid_on_time_attestation,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot
|
from eth2spec.test.helpers.constants import (
|
||||||
from eth2spec.test.context import (
|
|
||||||
CUSTODY_GAME,
|
CUSTODY_GAME,
|
||||||
MINIMAL,
|
MINIMAL,
|
||||||
|
)
|
||||||
|
from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot
|
||||||
|
from eth2spec.test.context import (
|
||||||
expect_assertion_error,
|
expect_assertion_error,
|
||||||
disable_process_reveal_deadlines,
|
disable_process_reveal_deadlines,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
from eth2spec.test.helpers.constants import CUSTODY_GAME
|
||||||
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 (
|
||||||
CUSTODY_GAME,
|
|
||||||
with_phases,
|
with_phases,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
expect_assertion_error,
|
expect_assertion_error,
|
||||||
|
|
|
@ -5,12 +5,14 @@ from eth2spec.test.helpers.custody import (
|
||||||
from eth2spec.test.helpers.attestations import (
|
from eth2spec.test.helpers.attestations import (
|
||||||
get_valid_on_time_attestation,
|
get_valid_on_time_attestation,
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import (
|
||||||
|
CUSTODY_GAME,
|
||||||
|
MINIMAL,
|
||||||
|
)
|
||||||
from eth2spec.test.helpers.keys import privkeys
|
from eth2spec.test.helpers.keys import privkeys
|
||||||
from eth2spec.utils.ssz.ssz_typing import ByteList
|
from eth2spec.utils.ssz.ssz_typing import ByteList
|
||||||
from eth2spec.test.helpers.state import get_balance, transition_to
|
from eth2spec.test.helpers.state import get_balance, transition_to
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
MINIMAL,
|
|
||||||
CUSTODY_GAME,
|
|
||||||
with_phases,
|
with_phases,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
expect_assertion_error,
|
expect_assertion_error,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
from eth2spec.test.helpers.constants import CUSTODY_GAME
|
||||||
from eth2spec.test.helpers.custody import get_valid_early_derived_secret_reveal
|
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 (
|
||||||
CUSTODY_GAME,
|
|
||||||
with_phases,
|
with_phases,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
expect_assertion_error,
|
expect_assertion_error,
|
||||||
|
|
|
@ -7,13 +7,15 @@ 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 (
|
||||||
CUSTODY_GAME,
|
|
||||||
MINIMAL,
|
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
with_phases,
|
with_phases,
|
||||||
with_configs,
|
with_configs,
|
||||||
)
|
)
|
||||||
from eth2spec.test.phase0.block_processing.test_process_attestation import run_attestation_processing
|
from eth2spec.test.phase0.block_processing.test_process_attestation import run_attestation_processing
|
||||||
|
from eth2spec.test.helpers.constants import (
|
||||||
|
CUSTODY_GAME,
|
||||||
|
MINIMAL,
|
||||||
|
)
|
||||||
from eth2spec.test.helpers.epoch_processing import run_epoch_processing_with
|
from eth2spec.test.helpers.epoch_processing import run_epoch_processing_with
|
||||||
|
|
||||||
from eth2spec.test.custody_game.block_processing.test_process_chunk_challenge import (
|
from eth2spec.test.custody_game.block_processing.test_process_chunk_challenge import (
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.helpers.constants import (
|
||||||
CUSTODY_GAME,
|
CUSTODY_GAME,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.custody import (
|
from eth2spec.test.helpers.custody import (
|
||||||
|
|
|
@ -3,12 +3,14 @@ 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 (
|
||||||
CUSTODY_GAME,
|
|
||||||
MINIMAL,
|
|
||||||
with_phases,
|
with_phases,
|
||||||
with_configs,
|
with_configs,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import (
|
||||||
|
CUSTODY_GAME,
|
||||||
|
MINIMAL,
|
||||||
|
)
|
||||||
from eth2spec.test.helpers.epoch_processing import run_epoch_processing_with
|
from eth2spec.test.helpers.epoch_processing import run_epoch_processing_with
|
||||||
from eth2spec.test.custody_game.block_processing.test_process_custody_key_reveal import (
|
from eth2spec.test.custody_game.block_processing.test_process_custody_key_reveal import (
|
||||||
run_custody_key_reveal_processing,
|
run_custody_key_reveal_processing,
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
from typing import Dict, Sequence
|
from typing import Dict, Sequence
|
||||||
|
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
CUSTODY_GAME,
|
|
||||||
MINIMAL,
|
|
||||||
with_phases,
|
with_phases,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
with_configs,
|
with_configs,
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.attestations import get_valid_on_time_attestation
|
from eth2spec.test.helpers.attestations import get_valid_on_time_attestation
|
||||||
from eth2spec.test.helpers.block import build_empty_block
|
from eth2spec.test.helpers.block import build_empty_block
|
||||||
|
from eth2spec.test.helpers.constants import (
|
||||||
|
CUSTODY_GAME,
|
||||||
|
MINIMAL,
|
||||||
|
)
|
||||||
from eth2spec.test.helpers.custody import (
|
from eth2spec.test.helpers.custody import (
|
||||||
get_custody_slashable_test_vector,
|
get_custody_slashable_test_vector,
|
||||||
get_valid_chunk_challenge,
|
get_valid_chunk_challenge,
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
from .typing import SpecForkName, ConfigName
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# SpecForkName
|
||||||
|
#
|
||||||
|
# Some of the Spec module functionality is exposed here to deal with phase-specific changes.
|
||||||
|
PHASE0 = SpecForkName('phase0')
|
||||||
|
ALTAIR = SpecForkName('altair')
|
||||||
|
|
||||||
|
# Experimental phases (not included in default "ALL_PHASES"):
|
||||||
|
MERGE = SpecForkName('merge')
|
||||||
|
SHARDING = SpecForkName('sharding')
|
||||||
|
CUSTODY_GAME = SpecForkName('custody_game')
|
||||||
|
DAS = SpecForkName('das')
|
||||||
|
|
||||||
|
# The forks that pytest runs with.
|
||||||
|
ALL_PHASES = (PHASE0, ALTAIR)
|
||||||
|
# The forks that output to the test vectors.
|
||||||
|
TESTGEN_FORKS = (PHASE0, ALTAIR)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Config
|
||||||
|
#
|
||||||
|
MAINNET = ConfigName('mainnet')
|
||||||
|
MINIMAL = ConfigName('minimal')
|
||||||
|
|
||||||
|
ALL_CONFIGS = (MINIMAL, MAINNET)
|
|
@ -0,0 +1,4 @@
|
||||||
|
from typing import NewType
|
||||||
|
|
||||||
|
SpecForkName = NewType("SpecForkName", str)
|
||||||
|
ConfigName = NewType("ConfigName", str)
|
|
@ -1,4 +1,5 @@
|
||||||
from eth2spec.test.context import PHASE0, spec_state_test, with_phases
|
from eth2spec.test.context import spec_state_test, with_phases
|
||||||
|
from eth2spec.test.helpers.constants import PHASE0
|
||||||
from eth2spec.test.helpers.epoch_processing import (
|
from eth2spec.test.helpers.epoch_processing import (
|
||||||
run_epoch_processing_with
|
run_epoch_processing_with
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from eth_utils import encode_hex
|
from eth_utils import encode_hex
|
||||||
|
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
MINIMAL,
|
|
||||||
is_post_altair,
|
is_post_altair,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
with_all_phases,
|
with_all_phases,
|
||||||
|
@ -9,6 +8,7 @@ from eth2spec.test.context import (
|
||||||
)
|
)
|
||||||
from eth2spec.test.helpers.attestations import get_valid_attestation, next_epoch_with_attestations
|
from eth2spec.test.helpers.attestations import get_valid_attestation, next_epoch_with_attestations
|
||||||
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.constants import MINIMAL
|
||||||
from eth2spec.test.helpers.fork_choice import (
|
from eth2spec.test.helpers.fork_choice import (
|
||||||
tick_and_run_on_attestation,
|
tick_and_run_on_attestation,
|
||||||
tick_and_run_on_block,
|
tick_and_run_on_block,
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
MINIMAL,
|
|
||||||
is_post_altair,
|
is_post_altair,
|
||||||
single_phase,
|
single_phase,
|
||||||
spec_test,
|
spec_test,
|
||||||
with_configs,
|
with_configs,
|
||||||
with_all_phases,
|
with_all_phases,
|
||||||
)
|
)
|
||||||
|
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,
|
||||||
prepare_random_genesis_deposits,
|
prepare_random_genesis_deposits,
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
MINIMAL,
|
|
||||||
is_post_altair,
|
is_post_altair,
|
||||||
spec_test,
|
spec_test,
|
||||||
single_phase,
|
single_phase,
|
||||||
with_configs,
|
with_configs,
|
||||||
with_all_phases,
|
with_all_phases,
|
||||||
)
|
)
|
||||||
|
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,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from eth2spec.test.context import PHASE0, with_all_phases, with_phases, spec_state_test
|
from eth2spec.test.context import with_all_phases, with_phases, spec_state_test
|
||||||
|
from eth2spec.test.helpers.constants import PHASE0
|
||||||
import eth2spec.test.helpers.rewards as rewards_helpers
|
import eth2spec.test.helpers.rewards as rewards_helpers
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from eth2spec.test.context import PHASE0, with_all_phases, with_phases, spec_state_test
|
from eth2spec.test.context import with_all_phases, with_phases, spec_state_test
|
||||||
|
from eth2spec.test.helpers.constants import PHASE0
|
||||||
from eth2spec.test.helpers.rewards import leaking
|
from eth2spec.test.helpers.rewards import leaking
|
||||||
import eth2spec.test.helpers.rewards as rewards_helpers
|
import eth2spec.test.helpers.rewards as rewards_helpers
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,8 @@ from eth2spec.test.helpers.multi_operations import (
|
||||||
run_slash_and_exit,
|
run_slash_and_exit,
|
||||||
run_test_full_random_operations,
|
run_test_full_random_operations,
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import PHASE0, MINIMAL
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
PHASE0, MINIMAL,
|
|
||||||
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,
|
||||||
expect_assertion_error, always_bls,
|
expect_assertion_error, always_bls,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from eth2spec.test.context import PHASE0, ALTAIR, with_all_phases, spec_state_test
|
from eth2spec.test.context import 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.constants import PHASE0, ALTAIR
|
||||||
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
|
||||||
from eth2spec.test.helpers.fork_choice import get_genesis_forkchoice_store
|
from eth2spec.test.helpers.fork_choice import get_genesis_forkchoice_store
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
always_bls, with_phases, with_all_phases,
|
always_bls, with_phases, with_all_phases,
|
||||||
PHASE0,
|
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import PHASE0
|
||||||
from eth2spec.test.helpers.attestations import build_attestation_data, get_valid_attestation
|
from eth2spec.test.helpers.attestations import build_attestation_data, get_valid_attestation
|
||||||
from eth2spec.test.helpers.block import build_empty_block
|
from eth2spec.test.helpers.block import build_empty_block
|
||||||
from eth2spec.test.helpers.deposits import prepare_state_and_deposit
|
from eth2spec.test.helpers.deposits import prepare_state_and_deposit
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
SHARDING,
|
|
||||||
with_phases,
|
with_phases,
|
||||||
spec_state_test,
|
spec_state_test,
|
||||||
)
|
)
|
||||||
|
from eth2spec.test.helpers.constants import SHARDING
|
||||||
from eth2spec.test.helpers.state import next_epoch
|
from eth2spec.test.helpers.state import next_epoch
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ 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.altair import spec as spec_altair
|
from eth2spec.altair import spec as spec_altair
|
||||||
from eth2spec.test.context import PHASE0, ALTAIR
|
from eth2spec.test.helpers.constants import PHASE0, 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
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ from eth_utils import (
|
||||||
import milagro_bls_binding as milagro_bls
|
import milagro_bls_binding as milagro_bls
|
||||||
|
|
||||||
from eth2spec.utils import bls
|
from eth2spec.utils import bls
|
||||||
from eth2spec.test.context import PHASE0
|
from eth2spec.test.helpers.constants import PHASE0
|
||||||
from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing
|
from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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.altair import spec as spec_altair
|
from eth2spec.altair import spec as spec_altair
|
||||||
from eth2spec.test.context import PHASE0, ALTAIR
|
from eth2spec.test.helpers.constants import PHASE0, ALTAIR
|
||||||
|
|
||||||
|
|
||||||
specs = (spec_phase0, spec_altair)
|
specs = (spec_phase0, spec_altair)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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.altair import spec as spec_altair
|
from eth2spec.altair import spec as spec_altair
|
||||||
from eth2spec.test.context import PHASE0, ALTAIR
|
from eth2spec.test.helpers.constants import PHASE0, ALTAIR
|
||||||
|
|
||||||
|
|
||||||
specs = (spec_phase0, spec_altair)
|
specs = (spec_phase0, spec_altair)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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.altair import spec as spec_altair
|
from eth2spec.altair import spec as spec_altair
|
||||||
from eth2spec.test.context import PHASE0, ALTAIR
|
from eth2spec.test.helpers.constants import PHASE0, ALTAIR
|
||||||
|
|
||||||
|
|
||||||
specs = (spec_phase0, spec_altair)
|
specs = (spec_phase0, spec_altair)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from importlib import reload
|
from importlib import reload
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
||||||
from eth2spec.test.context import PHASE0, ALTAIR, MINIMAL, MAINNET
|
from eth2spec.test.helpers.constants import PHASE0, ALTAIR, MINIMAL, MAINNET
|
||||||
from eth2spec.config import config_util
|
from eth2spec.config import config_util
|
||||||
from eth2spec.test.altair.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
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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.altair import spec as spec_altair
|
from eth2spec.altair import spec as spec_altair
|
||||||
from eth2spec.test.context import PHASE0, ALTAIR
|
from eth2spec.test.helpers.constants import PHASE0, ALTAIR
|
||||||
|
|
||||||
|
|
||||||
specs = (spec_phase0, spec_altair)
|
specs = (spec_phase0, spec_altair)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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.altair import spec as spec_altair
|
from eth2spec.altair import spec as spec_altair
|
||||||
from eth2spec.test.context import PHASE0, ALTAIR
|
from eth2spec.test.helpers.constants import PHASE0, ALTAIR
|
||||||
|
|
||||||
|
|
||||||
specs = (spec_phase0, spec_altair)
|
specs = (spec_phase0, spec_altair)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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.altair import spec as spec_altair
|
from eth2spec.altair import spec as spec_altair
|
||||||
from eth2spec.test.context import PHASE0, ALTAIR
|
from eth2spec.test.helpers.constants import PHASE0, ALTAIR
|
||||||
|
|
||||||
|
|
||||||
specs = (spec_phase0, spec_altair)
|
specs = (spec_phase0, spec_altair)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from eth2spec.phase0 import spec as spec_phase0
|
from eth2spec.phase0 import spec as spec_phase0
|
||||||
from eth2spec.altair import spec as spec_altair
|
from eth2spec.altair import spec as spec_altair
|
||||||
from eth2spec.test.context import PHASE0, ALTAIR
|
from eth2spec.test.helpers.constants import PHASE0, 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
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing
|
||||||
|
|
||||||
from eth2spec.config import config_util
|
from eth2spec.config import config_util
|
||||||
from eth2spec.phase0 import spec as spec
|
from eth2spec.phase0 import spec as spec
|
||||||
from eth2spec.test.context import PHASE0
|
from eth2spec.test.helpers.constants import PHASE0
|
||||||
|
|
||||||
|
|
||||||
def shuffling_case_fn(seed, count):
|
def shuffling_case_fn(seed, count):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import ssz_bitvector
|
||||||
import ssz_boolean
|
import ssz_boolean
|
||||||
import ssz_uints
|
import ssz_uints
|
||||||
import ssz_container
|
import ssz_container
|
||||||
from eth2spec.test.context import PHASE0
|
from eth2spec.test.helpers.constants import PHASE0
|
||||||
|
|
||||||
|
|
||||||
def create_provider(handler_name: str, suite_name: str, case_maker) -> gen_typing.TestProvider:
|
def create_provider(handler_name: str, suite_name: str, case_maker) -> gen_typing.TestProvider:
|
||||||
|
|
|
@ -9,7 +9,7 @@ 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.altair import spec as spec_altair
|
from eth2spec.altair import spec as spec_altair
|
||||||
from eth2spec.test.context import ALTAIR, TESTGEN_FORKS, MINIMAL, MAINNET
|
from eth2spec.test.helpers.constants import 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,
|
||||||
|
|
Loading…
Reference in New Issue