Merge branch 'dev' into prepare_state
This commit is contained in:
commit
62c828bd4b
|
@ -51,3 +51,9 @@ MIN_SYNC_COMMITTEE_PARTICIPANTS: 1
|
|||
MAX_VALID_LIGHT_CLIENT_UPDATES: 8192
|
||||
# 2**13 (=8192)
|
||||
LIGHT_CLIENT_UPDATE_TIMEOUT: 8192
|
||||
|
||||
|
||||
# Validator
|
||||
# ---------------------------------------------------------------
|
||||
# 2**2 (= 4)
|
||||
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE: 4
|
||||
|
|
|
@ -51,3 +51,8 @@ MIN_SYNC_COMMITTEE_PARTICIPANTS: 1
|
|||
MAX_VALID_LIGHT_CLIENT_UPDATES: 32
|
||||
# [customized]
|
||||
LIGHT_CLIENT_UPDATE_TIMEOUT: 32
|
||||
|
||||
# Validator
|
||||
# ---------------------------------------------------------------
|
||||
# 2**2 (= 4)
|
||||
TARGET_AGGREGATORS_PER_SYNC_SUBCOMMITTEE: 4
|
||||
|
|
2
setup.py
2
setup.py
|
@ -695,7 +695,7 @@ setup(
|
|||
"py_ecc==5.2.0",
|
||||
"milagro_bls_binding==1.6.3",
|
||||
"dataclasses==0.6",
|
||||
"remerkleable==0.1.18",
|
||||
"remerkleable==0.1.19",
|
||||
"ruamel.yaml==0.16.5",
|
||||
"lru-dict==1.1.6",
|
||||
]
|
||||
|
|
|
@ -4,7 +4,8 @@ from typing import Any, Callable, Dict, Iterable, Optional
|
|||
|
||||
from eth2spec.config import config_util
|
||||
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.gen_typing import TestCase, TestProvider
|
||||
|
|
|
@ -8,12 +8,14 @@ from eth2spec.test.helpers.state import (
|
|||
state_transition_and_sign_block,
|
||||
transition_to,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
PHASE0,
|
||||
MAINNET, MINIMAL,
|
||||
)
|
||||
from eth2spec.test.helpers.sync_committee import (
|
||||
compute_aggregate_sync_committee_signature,
|
||||
)
|
||||
from eth2spec.test.context import (
|
||||
PHASE0,
|
||||
MAINNET, MINIMAL,
|
||||
expect_assertion_error,
|
||||
with_all_phases_except,
|
||||
with_configs,
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
from eth2spec.test.context import (
|
||||
PHASE0,
|
||||
MINIMAL,
|
||||
spec_state_test,
|
||||
with_all_phases_except,
|
||||
with_configs,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
PHASE0,
|
||||
MINIMAL,
|
||||
)
|
||||
from eth2spec.test.helpers.state import transition_to
|
||||
from eth2spec.test.helpers.epoch_processing import (
|
||||
run_epoch_processing_with,
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
from eth2spec.test.context import (
|
||||
PHASE0, ALTAIR,
|
||||
MINIMAL,
|
||||
with_phases,
|
||||
with_custom_state,
|
||||
with_configs,
|
||||
|
@ -8,6 +6,10 @@ from eth2spec.test.context import (
|
|||
low_balances, misc_balances, large_validator_set,
|
||||
)
|
||||
from eth2spec.test.utils import with_meta_tags
|
||||
from eth2spec.test.helpers.constants import (
|
||||
PHASE0, ALTAIR,
|
||||
MINIMAL,
|
||||
)
|
||||
from eth2spec.test.helpers.state import (
|
||||
next_epoch,
|
||||
next_epoch_via_block,
|
||||
|
|
|
@ -11,8 +11,8 @@ from eth2spec.test.helpers.block import (
|
|||
from eth2spec.test.helpers.sync_committee import (
|
||||
compute_aggregate_sync_committee_signature,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import PHASE0
|
||||
from eth2spec.test.context import (
|
||||
PHASE0,
|
||||
with_all_phases_except,
|
||||
spec_state_test,
|
||||
)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from eth2spec.test.context import (
|
||||
spec_state_test,
|
||||
with_phases,
|
||||
ALTAIR,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import ALTAIR
|
||||
from eth2spec.test.helpers.merkle import build_proof
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
from eth2spec.test.context import (
|
||||
ALTAIR,
|
||||
MINIMAL,
|
||||
spec_state_test,
|
||||
with_configs,
|
||||
with_phases,
|
||||
|
@ -10,6 +8,10 @@ from eth2spec.test.helpers.block import (
|
|||
build_empty_block,
|
||||
build_empty_block_for_next_slot,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
ALTAIR,
|
||||
MINIMAL,
|
||||
)
|
||||
from eth2spec.test.helpers.state import (
|
||||
next_slots,
|
||||
state_transition_and_sign_block,
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
import random
|
||||
from collections import defaultdict
|
||||
from eth2spec.utils.ssz.ssz_typing import Bitvector
|
||||
from eth2spec.test.helpers.block import build_empty_block
|
||||
from eth2spec.test.helpers.keys import pubkey_to_privkey
|
||||
from eth2spec.test.helpers.state import transition_to
|
||||
from eth2spec.utils import bls
|
||||
from eth2spec.utils.bls import only_with_bls
|
||||
from eth2spec.test.context import (
|
||||
PHASE0,
|
||||
with_all_phases_except,
|
||||
with_state,
|
||||
)
|
||||
|
||||
rng = random.Random(1337)
|
||||
|
||||
|
||||
def ensure_assignments_in_sync_committee(
|
||||
spec, state, epoch, sync_committee, active_pubkeys
|
||||
):
|
||||
assert len(sync_committee.pubkeys) >= 3
|
||||
some_pubkeys = rng.sample(sync_committee.pubkeys, 3)
|
||||
for pubkey in some_pubkeys:
|
||||
validator_index = active_pubkeys.index(pubkey)
|
||||
assert spec.is_assigned_to_sync_committee(state, epoch, validator_index)
|
||||
|
||||
|
||||
@with_all_phases_except([PHASE0])
|
||||
@with_state
|
||||
def test_is_assigned_to_sync_committee(phases, spec, state):
|
||||
epoch = spec.get_current_epoch(state)
|
||||
validator_indices = spec.get_active_validator_indices(state, epoch)
|
||||
validator_count = len(validator_indices)
|
||||
|
||||
query_epoch = epoch + 1
|
||||
next_query_epoch = query_epoch + spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||
active_pubkeys = [state.validators[index].pubkey for index in validator_indices]
|
||||
|
||||
ensure_assignments_in_sync_committee(
|
||||
spec, state, query_epoch, state.current_sync_committee, active_pubkeys
|
||||
)
|
||||
ensure_assignments_in_sync_committee(
|
||||
spec, state, next_query_epoch, state.next_sync_committee, active_pubkeys
|
||||
)
|
||||
|
||||
sync_committee_pubkeys = set(
|
||||
list(state.current_sync_committee.pubkeys)
|
||||
+ list(state.next_sync_committee.pubkeys)
|
||||
)
|
||||
disqualified_pubkeys = set(
|
||||
filter(lambda key: key not in sync_committee_pubkeys, active_pubkeys)
|
||||
)
|
||||
# NOTE: only check `disqualified_pubkeys` if SYNC_COMMITEE_SIZE < validator count
|
||||
if disqualified_pubkeys:
|
||||
sample_size = 3
|
||||
assert validator_count >= sample_size
|
||||
some_pubkeys = rng.sample(disqualified_pubkeys, sample_size)
|
||||
for pubkey in some_pubkeys:
|
||||
validator_index = active_pubkeys.index(pubkey)
|
||||
is_current = spec.is_assigned_to_sync_committee(
|
||||
state, query_epoch, validator_index
|
||||
)
|
||||
is_next = spec.is_assigned_to_sync_committee(
|
||||
state, next_query_epoch, validator_index
|
||||
)
|
||||
is_current_or_next = is_current or is_next
|
||||
assert not is_current_or_next
|
||||
|
||||
|
||||
def _get_sync_committee_signature(
|
||||
spec,
|
||||
state,
|
||||
target_slot,
|
||||
target_block_root,
|
||||
subcommittee_index,
|
||||
index_in_subcommittee,
|
||||
):
|
||||
subcommittee_size = spec.SYNC_COMMITTEE_SIZE // spec.SYNC_COMMITTEE_SUBNET_COUNT
|
||||
sync_committee_index = (
|
||||
subcommittee_index * subcommittee_size + index_in_subcommittee
|
||||
)
|
||||
pubkey = state.current_sync_committee.pubkeys[sync_committee_index]
|
||||
privkey = pubkey_to_privkey[pubkey]
|
||||
|
||||
domain = spec.get_domain(
|
||||
state,
|
||||
spec.DOMAIN_SYNC_COMMITTEE,
|
||||
)
|
||||
signing_data = spec.compute_signing_root(target_block_root, domain)
|
||||
return bls.Sign(privkey, spec.hash_tree_root(signing_data))
|
||||
|
||||
|
||||
@only_with_bls()
|
||||
@with_all_phases_except([PHASE0])
|
||||
@with_state
|
||||
def test_process_sync_committee_contributions(phases, spec, state):
|
||||
# skip over slots at genesis
|
||||
transition_to(spec, state, state.slot + 3)
|
||||
|
||||
# build a block and attempt to assemble a sync aggregate
|
||||
# from some sync committee contributions
|
||||
block = build_empty_block(spec, state)
|
||||
previous_slot = state.slot - 1
|
||||
target_block_root = spec.get_block_root_at_slot(state, previous_slot)
|
||||
aggregation_bits = Bitvector[
|
||||
spec.SYNC_COMMITTEE_SIZE // spec.SYNC_COMMITTEE_SUBNET_COUNT
|
||||
]()
|
||||
aggregation_index = 0
|
||||
aggregation_bits[aggregation_index] = True
|
||||
|
||||
contributions = [
|
||||
spec.SyncCommitteeContribution(
|
||||
slot=block.slot,
|
||||
beacon_block_root=target_block_root,
|
||||
subcommittee_index=i,
|
||||
aggregation_bits=aggregation_bits,
|
||||
signature=_get_sync_committee_signature(
|
||||
spec, state, previous_slot, target_block_root, i, aggregation_index
|
||||
),
|
||||
)
|
||||
for i in range(spec.SYNC_COMMITTEE_SUBNET_COUNT)
|
||||
]
|
||||
|
||||
# ensure the block has an empty sync aggregate...
|
||||
empty_sync_aggregate = spec.SyncAggregate()
|
||||
empty_sync_aggregate.sync_committee_signature = spec.G2_POINT_AT_INFINITY
|
||||
assert block.body.sync_aggregate == empty_sync_aggregate
|
||||
spec.process_sync_committee_contributions(block, set(contributions))
|
||||
|
||||
# and that after processing, it is no longer empty
|
||||
assert len(block.body.sync_aggregate.sync_committee_bits) != 0
|
||||
assert (
|
||||
block.body.sync_aggregate.sync_committee_signature != spec.G2_POINT_AT_INFINITY
|
||||
)
|
||||
# moreover, ensure the sync aggregate is valid if the block is accepted
|
||||
spec.process_block(state, block)
|
||||
|
||||
|
||||
def _validator_index_for_pubkey(state, pubkey):
|
||||
return list(map(lambda v: v.pubkey, state.validators)).index(pubkey)
|
||||
|
||||
|
||||
def _subnet_for_sync_committee_index(spec, i):
|
||||
return i // (spec.SYNC_COMMITTEE_SIZE // spec.SYNC_COMMITTEE_SUBNET_COUNT)
|
||||
|
||||
|
||||
@with_all_phases_except([PHASE0])
|
||||
@with_state
|
||||
def test_compute_subnets_for_sync_committee(state, spec, phases):
|
||||
some_sync_committee_members = list(
|
||||
(
|
||||
_subnet_for_sync_committee_index(spec, i),
|
||||
pubkey,
|
||||
)
|
||||
for i, pubkey in enumerate(state.current_sync_committee.pubkeys)
|
||||
)
|
||||
|
||||
expected_subnets_by_pubkey = defaultdict(list)
|
||||
for (subnet, pubkey) in some_sync_committee_members:
|
||||
expected_subnets_by_pubkey[pubkey].append(subnet)
|
||||
|
||||
for _, pubkey in some_sync_committee_members:
|
||||
validator_index = _validator_index_for_pubkey(state, pubkey)
|
||||
subnets = spec.compute_subnets_for_sync_committee(state, validator_index)
|
||||
expected_subnets = expected_subnets_by_pubkey[pubkey]
|
||||
assert subnets == expected_subnets
|
|
@ -6,11 +6,15 @@ from eth2spec.merge import spec as spec_merge
|
|||
from eth2spec.utils import bls
|
||||
|
||||
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 .utils import vector_test, with_meta_tags
|
||||
|
||||
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
|
||||
|
||||
|
@ -23,30 +27,6 @@ def reload_specs():
|
|||
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.
|
||||
# It would be better if they would be more well-defined interfaces for stronger typing.
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from eth2spec.test.context import (
|
||||
CUSTODY_GAME,
|
||||
with_phases,
|
||||
spec_state_test,
|
||||
always_bls,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import CUSTODY_GAME
|
||||
from eth2spec.test.helpers.state import transition_to
|
||||
from eth2spec.test.helpers.attestations import (
|
||||
run_attestation_processing,
|
||||
|
|
|
@ -6,10 +6,12 @@ from eth2spec.test.helpers.custody import (
|
|||
from eth2spec.test.helpers.attestations import (
|
||||
get_valid_on_time_attestation,
|
||||
)
|
||||
from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot
|
||||
from eth2spec.test.context import (
|
||||
from eth2spec.test.helpers.constants import (
|
||||
CUSTODY_GAME,
|
||||
MINIMAL,
|
||||
)
|
||||
from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot
|
||||
from eth2spec.test.context import (
|
||||
expect_assertion_error,
|
||||
disable_process_reveal_deadlines,
|
||||
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.context import (
|
||||
CUSTODY_GAME,
|
||||
with_phases,
|
||||
spec_state_test,
|
||||
expect_assertion_error,
|
||||
|
|
|
@ -5,12 +5,14 @@ from eth2spec.test.helpers.custody import (
|
|||
from eth2spec.test.helpers.attestations import (
|
||||
get_valid_on_time_attestation,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import (
|
||||
CUSTODY_GAME,
|
||||
MINIMAL,
|
||||
)
|
||||
from eth2spec.test.helpers.keys import privkeys
|
||||
from eth2spec.utils.ssz.ssz_typing import ByteList
|
||||
from eth2spec.test.helpers.state import get_balance, transition_to
|
||||
from eth2spec.test.context import (
|
||||
MINIMAL,
|
||||
CUSTODY_GAME,
|
||||
with_phases,
|
||||
spec_state_test,
|
||||
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.state import next_epoch_via_block, get_balance
|
||||
from eth2spec.test.context import (
|
||||
CUSTODY_GAME,
|
||||
with_phases,
|
||||
spec_state_test,
|
||||
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.context import (
|
||||
CUSTODY_GAME,
|
||||
MINIMAL,
|
||||
spec_state_test,
|
||||
with_phases,
|
||||
with_configs,
|
||||
)
|
||||
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.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,
|
||||
)
|
||||
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.context import (
|
||||
CUSTODY_GAME,
|
||||
MINIMAL,
|
||||
with_phases,
|
||||
with_configs,
|
||||
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.custody_game.block_processing.test_process_custody_key_reveal import (
|
||||
run_custody_key_reveal_processing,
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
from typing import Dict, Sequence
|
||||
|
||||
from eth2spec.test.context import (
|
||||
CUSTODY_GAME,
|
||||
MINIMAL,
|
||||
with_phases,
|
||||
spec_state_test,
|
||||
with_configs,
|
||||
)
|
||||
from eth2spec.test.helpers.attestations import get_valid_on_time_attestation
|
||||
from eth2spec.test.helpers.block import build_empty_block
|
||||
from eth2spec.test.helpers.constants import (
|
||||
CUSTODY_GAME,
|
||||
MINIMAL,
|
||||
)
|
||||
from eth2spec.test.helpers.custody import (
|
||||
get_custody_slashable_test_vector,
|
||||
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 (
|
||||
run_epoch_processing_with
|
||||
)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from eth_utils import encode_hex
|
||||
|
||||
from eth2spec.test.context import (
|
||||
MINIMAL,
|
||||
is_post_altair,
|
||||
spec_state_test,
|
||||
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.block import build_empty_block_for_next_slot
|
||||
from eth2spec.test.helpers.constants import MINIMAL
|
||||
from eth2spec.test.helpers.fork_choice import (
|
||||
tick_and_run_on_attestation,
|
||||
tick_and_run_on_block,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from eth2spec.test.context import (
|
||||
MINIMAL,
|
||||
is_post_altair,
|
||||
single_phase,
|
||||
spec_test,
|
||||
with_configs,
|
||||
with_all_phases,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import MINIMAL
|
||||
from eth2spec.test.helpers.deposits import (
|
||||
prepare_full_genesis_deposits,
|
||||
prepare_random_genesis_deposits,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from eth2spec.test.context import (
|
||||
MINIMAL,
|
||||
is_post_altair,
|
||||
spec_test,
|
||||
single_phase,
|
||||
with_configs,
|
||||
with_all_phases,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import MINIMAL
|
||||
from eth2spec.test.helpers.deposits import (
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
import eth2spec.test.helpers.rewards as rewards_helpers
|
||||
|
||||
|
|
|
@ -24,9 +24,8 @@ from eth2spec.test.helpers.multi_operations import (
|
|||
run_slash_and_exit,
|
||||
run_test_full_random_operations,
|
||||
)
|
||||
|
||||
from eth2spec.test.helpers.constants import PHASE0, MINIMAL
|
||||
from eth2spec.test.context import (
|
||||
PHASE0, MINIMAL,
|
||||
spec_test, spec_state_test, dump_skipping_message,
|
||||
with_phases, with_all_phases, single_phase,
|
||||
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.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.fork_choice import get_genesis_forkchoice_store
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from eth2spec.test.context import (
|
||||
spec_state_test,
|
||||
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.block import build_empty_block
|
||||
from eth2spec.test.helpers.deposits import prepare_state_and_deposit
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from eth2spec.test.context import (
|
||||
SHARDING,
|
||||
with_phases,
|
||||
spec_state_test,
|
||||
)
|
||||
from eth2spec.test.helpers.constants import SHARDING
|
||||
from eth2spec.test.helpers.state import next_epoch
|
||||
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ Another example, to generate tests from pytests:
|
|||
```python
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
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
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ from eth_utils import (
|
|||
import milagro_bls_binding as milagro_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
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
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)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
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)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
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)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from importlib import reload
|
||||
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.test.altair.fork import test_fork as test_altair_forks
|
||||
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.phase0 import spec as spec_phase0
|
||||
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)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
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)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
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)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from eth2spec.phase0 import spec as spec_phase0
|
||||
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
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing
|
|||
|
||||
from eth2spec.config import config_util
|
||||
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):
|
||||
|
|
|
@ -6,7 +6,7 @@ import ssz_bitvector
|
|||
import ssz_boolean
|
||||
import ssz_uints
|
||||
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:
|
||||
|
|
|
@ -9,7 +9,7 @@ from eth2spec.debug import random_value, encode
|
|||
from eth2spec.config import config_util
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
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_impl import (
|
||||
hash_tree_root,
|
||||
|
|
Loading…
Reference in New Issue