preserve proof of custody tests

This commit is contained in:
protolambda
2021-03-26 23:07:48 +01:00
parent 14cb996613
commit 906cde0610
11 changed files with 82 additions and 168 deletions

View File

@@ -29,7 +29,13 @@ ConfigName = NewType("ConfigName", str)
PHASE0 = SpecForkName('phase0')
ALTAIR = SpecForkName('altair')
ALL_PHASES = (PHASE0, ALTAIR) # TODO add merge, sharding, proof_of_custody and das as phases.
# Experimental phases (not included in default "ALL_PHASES"):
MERGE = SpecForkName('merge')
SHARDING = SpecForkName('sharding')
PROOF_OF_CUSTODY = SpecForkName('proof_of_custody')
DAS = SpecForkName('das')
ALL_PHASES = (PHASE0, ALTAIR)
MAINNET = ConfigName('mainnet')
MINIMAL = ConfigName('minimal')

View File

@@ -1,7 +1,6 @@
from eth2spec.test.context import (
PHASE0,
ALTAIR,
with_all_phases_except,
PROOF_OF_CUSTODY,
with_phases,
spec_state_test,
always_bls,
)
@@ -13,7 +12,7 @@ from eth2spec.test.helpers.attestations import (
)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@always_bls
def test_on_time_success(spec, state):
@@ -24,7 +23,7 @@ def test_on_time_success(spec, state):
yield from run_attestation_processing(spec, state, attestation)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@always_bls
def test_late_success(spec, state):

View File

@@ -8,13 +8,12 @@ from eth2spec.test.helpers.attestations import (
)
from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot
from eth2spec.test.context import (
PHASE0,
ALTAIR,
PROOF_OF_CUSTODY,
MINIMAL,
expect_assertion_error,
disable_process_reveal_deadlines,
spec_state_test,
with_all_phases_except,
with_phases,
with_configs,
)
from eth2spec.test.phase0.block_processing.test_process_attestation import run_attestation_processing
@@ -69,7 +68,7 @@ def run_custody_chunk_response_processing(spec, state, custody_response, valid=T
yield 'post', state
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@with_configs([MINIMAL], reason="too slow")
@disable_process_reveal_deadlines
@@ -93,7 +92,7 @@ def test_challenge_appended(spec, state):
yield from run_chunk_challenge_processing(spec, state, challenge)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -119,7 +118,7 @@ def test_challenge_empty_element_replaced(spec, state):
yield from run_chunk_challenge_processing(spec, state, challenge)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -145,7 +144,7 @@ def test_duplicate_challenge(spec, state):
yield from run_chunk_challenge_processing(spec, state, challenge, valid=False)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -173,7 +172,7 @@ def test_second_challenge(spec, state):
yield from run_chunk_challenge_processing(spec, state, challenge1)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -198,7 +197,7 @@ def test_multiple_epochs_custody(spec, state):
yield from run_chunk_challenge_processing(spec, state, challenge)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -223,7 +222,7 @@ def test_many_epochs_custody(spec, state):
yield from run_chunk_challenge_processing(spec, state, challenge)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -244,7 +243,7 @@ def test_off_chain_attestation(spec, state):
yield from run_chunk_challenge_processing(spec, state, challenge)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -276,7 +275,7 @@ def test_custody_response(spec, state):
yield from run_custody_chunk_response_processing(spec, state, custody_response)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -307,7 +306,7 @@ def test_custody_response_chunk_index_2(spec, state):
yield from run_custody_chunk_response_processing(spec, state, custody_response)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -339,7 +338,7 @@ def test_custody_response_multiple_epochs(spec, state):
yield from run_custody_chunk_response_processing(spec, state, custody_response)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")

View File

@@ -1,8 +1,7 @@
from eth2spec.test.helpers.custody import get_valid_custody_key_reveal
from eth2spec.test.context import (
PHASE0,
ALTAIR,
with_all_phases_except,
PROOF_OF_CUSTODY,
with_phases,
spec_state_test,
expect_assertion_error,
always_bls,
@@ -40,7 +39,7 @@ def run_custody_key_reveal_processing(spec, state, custody_key_reveal, valid=Tru
yield 'post', state
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@always_bls
def test_success(spec, state):
@@ -50,7 +49,7 @@ def test_success(spec, state):
yield from run_custody_key_reveal_processing(spec, state, custody_key_reveal)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@always_bls
def test_reveal_too_early(spec, state):
@@ -59,7 +58,7 @@ def test_reveal_too_early(spec, state):
yield from run_custody_key_reveal_processing(spec, state, custody_key_reveal, False)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@always_bls
def test_wrong_period(spec, state):
@@ -68,7 +67,7 @@ def test_wrong_period(spec, state):
yield from run_custody_key_reveal_processing(spec, state, custody_key_reveal, False)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@always_bls
def test_late_reveal(spec, state):
@@ -78,7 +77,7 @@ def test_late_reveal(spec, state):
yield from run_custody_key_reveal_processing(spec, state, custody_key_reveal)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@always_bls
def test_double_reveal(spec, state):

View File

@@ -9,10 +9,8 @@ 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 (
PHASE0,
MINIMAL,
ALTAIR,
with_all_phases_except,
PROOF_OF_CUSTODY,
with_phases,
spec_state_test,
expect_assertion_error,
disable_process_reveal_deadlines,
@@ -113,7 +111,7 @@ def run_standard_custody_slashing_test(spec,
yield from run_custody_slashing_processing(spec, state, slashing, valid=valid, correct=correct)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -121,7 +119,7 @@ def test_custody_slashing(spec, state):
yield from run_standard_custody_slashing_test(spec, state)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -129,7 +127,7 @@ def test_incorrect_custody_slashing(spec, state):
yield from run_standard_custody_slashing_test(spec, state, correct=False)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -137,7 +135,7 @@ def test_multiple_epochs_custody(spec, state):
yield from run_standard_custody_slashing_test(spec, state, shard_lateness=spec.SLOTS_PER_EPOCH * 3)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")
@@ -145,7 +143,7 @@ def test_many_epochs_custody(spec, state):
yield from run_standard_custody_slashing_test(spec, state, shard_lateness=spec.SLOTS_PER_EPOCH * 5)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@disable_process_reveal_deadlines
@with_configs([MINIMAL], reason="too slow")

View File

@@ -1,9 +1,8 @@
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 (
PHASE0,
ALTAIR,
with_all_phases_except,
PROOF_OF_CUSTODY,
with_phases,
spec_state_test,
expect_assertion_error,
always_bls,
@@ -42,7 +41,7 @@ def run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, v
yield 'post', state
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@always_bls
def test_success(spec, state):
@@ -51,7 +50,7 @@ def test_success(spec, state):
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@never_bls
def test_reveal_from_current_epoch(spec, state):
@@ -60,7 +59,7 @@ def test_reveal_from_current_epoch(spec, state):
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@never_bls
def test_reveal_from_past_epoch(spec, state):
@@ -70,7 +69,7 @@ def test_reveal_from_past_epoch(spec, state):
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@always_bls
def test_reveal_with_custody_padding(spec, state):
@@ -82,7 +81,7 @@ def test_reveal_with_custody_padding(spec, state):
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, True)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@always_bls
def test_reveal_with_custody_padding_minus_one(spec, state):
@@ -94,7 +93,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)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@never_bls
def test_double_reveal(spec, state):
@@ -115,7 +114,7 @@ def test_double_reveal(spec, state):
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal2, False)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@never_bls
def test_revealer_is_slashed(spec, state):
@@ -125,7 +124,7 @@ def test_revealer_is_slashed(spec, state):
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@never_bls
def test_far_future_epoch(spec, state):

View File

@@ -7,17 +7,16 @@ from eth2spec.test.helpers.attestations import (
)
from eth2spec.test.helpers.state import transition_to, transition_to_valid_shard_slot
from eth2spec.test.context import (
PHASE0,
ALTAIR,
PROOF_OF_CUSTODY,
MINIMAL,
spec_state_test,
with_all_phases_except,
with_phases,
with_configs,
)
from eth2spec.test.phase0.block_processing.test_process_attestation import run_attestation_processing
from eth2spec.test.helpers.epoch_processing import run_epoch_processing_with
from eth2spec.test.phase1.block_processing.test_process_chunk_challenge import (
from eth2spec.test.proof_of_custody.block_processing.test_process_chunk_challenge import (
run_chunk_challenge_processing,
)
@@ -26,7 +25,7 @@ def run_process_challenge_deadlines(spec, state):
yield from run_epoch_processing_with(spec, state, 'process_challenge_deadlines')
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@with_configs([MINIMAL], reason="too slow")
def test_validator_slashed_after_chunk_challenge(spec, state):

View File

@@ -1,6 +1,5 @@
from eth2spec.test.context import (
PHASE0,
ALTAIR,
PROOF_OF_CUSTODY,
)
from eth2spec.test.helpers.custody import (
get_valid_chunk_challenge,
@@ -13,24 +12,26 @@ from eth2spec.test.helpers.attestations import (
)
from eth2spec.test.helpers.state import next_epoch_via_block, transition_to, transition_to_valid_shard_slot
from eth2spec.test.context import (
with_all_phases_except,
with_phases,
spec_state_test,
)
from eth2spec.test.phase0.block_processing.test_process_attestation import run_attestation_processing
from eth2spec.test.helpers.epoch_processing import run_epoch_processing_with
from eth2spec.test.phase1.block_processing.test_process_chunk_challenge import (
from eth2spec.test.proof_of_custody.block_processing.test_process_chunk_challenge import (
run_chunk_challenge_processing,
run_custody_chunk_response_processing,
)
from eth2spec.test.phase1.block_processing.test_process_custody_key_reveal import run_custody_key_reveal_processing
from eth2spec.test.proof_of_custody.block_processing.test_process_custody_key_reveal import (
run_custody_key_reveal_processing,
)
def run_process_custody_final_updates(spec, state):
yield from run_epoch_processing_with(spec, state, 'process_custody_final_updates')
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
def test_validator_withdrawal_delay(spec, state):
transition_to_valid_shard_slot(spec, state)
@@ -43,7 +44,7 @@ def test_validator_withdrawal_delay(spec, state):
assert state.validators[0].withdrawable_epoch == spec.FAR_FUTURE_EPOCH
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
def test_validator_withdrawal_reenable_after_custody_reveal(spec, state):
transition_to_valid_shard_slot(spec, state)
@@ -68,7 +69,7 @@ def test_validator_withdrawal_reenable_after_custody_reveal(spec, state):
assert state.validators[0].withdrawable_epoch < spec.FAR_FUTURE_EPOCH
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
def test_validator_withdrawal_suspend_after_chunk_challenge(spec, state):
transition_to_valid_shard_slot(spec, state)
@@ -117,7 +118,7 @@ def test_validator_withdrawal_suspend_after_chunk_challenge(spec, state):
assert state.validators[validator_index].withdrawable_epoch == spec.FAR_FUTURE_EPOCH
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
def test_validator_withdrawal_resume_after_chunk_challenge_response(spec, state):
transition_to_valid_shard_slot(spec, state)

View File

@@ -3,22 +3,23 @@ from eth2spec.test.helpers.custody import (
)
from eth2spec.test.helpers.state import transition_to
from eth2spec.test.context import (
PHASE0,
ALTAIR,
PROOF_OF_CUSTODY,
MINIMAL,
with_all_phases_except,
with_phases,
with_configs,
spec_state_test,
)
from eth2spec.test.helpers.epoch_processing import run_epoch_processing_with
from eth2spec.test.phase1.block_processing.test_process_custody_key_reveal import run_custody_key_reveal_processing
from eth2spec.test.proof_of_custody.block_processing.test_process_custody_key_reveal import (
run_custody_key_reveal_processing,
)
def run_process_challenge_deadlines(spec, state):
yield from run_epoch_processing_with(spec, state, 'process_challenge_deadlines')
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@with_configs([MINIMAL], reason="too slow")
def test_validator_slashed_after_reveal_deadline(spec, state):
@@ -38,7 +39,7 @@ def test_validator_slashed_after_reveal_deadline(spec, state):
assert state.validators[0].slashed == 1
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@with_configs([MINIMAL], reason="too slow")
def test_validator_not_slashed_after_reveal(spec, state):

View File

@@ -1,10 +1,9 @@
from typing import Dict, Sequence
from eth2spec.test.context import (
PHASE0,
ALTAIR,
PROOF_OF_CUSTODY,
MINIMAL,
with_all_phases_except,
with_phases,
spec_state_test,
only_full_crosslink,
with_configs,
@@ -43,97 +42,12 @@ def run_beacon_block(spec, state, block, valid=True):
yield 'post', state
#
# Beacon block with non-empty shard transitions
#
def run_beacon_block_with_shard_blocks(spec, state, target_len_offset_slot, committee_index, shard, valid=True):
transition_to(spec, state, state.slot + target_len_offset_slot)
body = get_sample_shard_block_body(spec, is_max=True)
shard_block = build_shard_block(spec, state, shard, body=body, slot=state.slot, signed=True)
shard_block_dict: Dict[spec.Shard, Sequence[spec.SignedShardBlock]] = {shard: [shard_block]}
shard_transitions = get_shard_transitions(spec, state, shard_block_dict)
attestations = [
get_valid_on_time_attestation(
spec,
state,
index=committee_index,
shard_transition=shard_transitions[shard],
signed=True,
)
for shard in shard_block_dict.keys()
]
beacon_block = build_empty_block(spec, state, slot=state.slot + 1)
beacon_block.body.attestations = attestations
beacon_block.body.shard_transitions = shard_transitions
pre_gasprice = state.shard_states[shard].gasprice
pre_shard_states = state.shard_states.copy()
yield 'pre', state.copy()
if not valid:
state_transition_and_sign_block(spec, state, beacon_block, expect_fail=True)
yield 'block', beacon_block
yield 'post', None
return
signed_beacon_block = state_transition_and_sign_block(spec, state, beacon_block)
yield 'block', signed_beacon_block
yield 'post', state
for shard in range(spec.get_active_shard_count(state)):
post_shard_state = state.shard_states[shard]
if shard in shard_block_dict:
# Shard state has been changed to state_transition result
assert post_shard_state == shard_transitions[shard].shard_states[
len(shard_transitions[shard].shard_states) - 1
]
assert post_shard_state.slot == state.slot - 1
if len((shard_block_dict[shard])) == 0:
# `latest_block_root` is the same
assert post_shard_state.latest_block_root == pre_shard_states[shard].latest_block_root
if target_len_offset_slot == 1 and len(shard_block_dict[shard]) > 0:
assert post_shard_state.gasprice > pre_gasprice
@with_all_phases_except([PHASE0, ALTAIR])
@spec_state_test
@only_full_crosslink
def test_process_beacon_block_with_normal_shard_transition(spec, state):
transition_to_valid_shard_slot(spec, state)
target_len_offset_slot = 1
committee_index = spec.CommitteeIndex(0)
shard = spec.compute_shard_from_committee_index(state, committee_index, state.slot + target_len_offset_slot - 1)
assert state.shard_states[shard].slot == state.slot - 1
yield from run_beacon_block_with_shard_blocks(spec, state, target_len_offset_slot, committee_index, shard)
@with_all_phases_except([PHASE0, ALTAIR])
@spec_state_test
@only_full_crosslink
def test_process_beacon_block_with_empty_proposal_transition(spec, state):
transition_to_valid_shard_slot(spec, state)
target_len_offset_slot = 1
committee_index = spec.CommitteeIndex(0)
shard = spec.compute_shard_from_committee_index(state, committee_index, state.slot + target_len_offset_slot - 1)
assert state.shard_states[shard].slot == state.slot - 1
yield from run_beacon_block_with_shard_blocks(spec, state, target_len_offset_slot, committee_index, shard)
#
# Beacon block with custody operations
#
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@only_full_crosslink
def test_with_shard_transition_with_custody_challenge_and_response(spec, state):
@@ -167,7 +81,7 @@ def test_with_shard_transition_with_custody_challenge_and_response(spec, state):
yield from run_beacon_block(spec, state, block)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@with_configs([MINIMAL])
def test_custody_key_reveal(spec, state):
@@ -181,7 +95,7 @@ def test_custody_key_reveal(spec, state):
yield from run_beacon_block(spec, state, block)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
def test_early_derived_secret_reveal(spec, state):
transition_to_valid_shard_slot(spec, state)
@@ -192,7 +106,7 @@ def test_early_derived_secret_reveal(spec, state):
yield from run_beacon_block(spec, state, block)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([PROOF_OF_CUSTODY])
@spec_state_test
@only_full_crosslink
def test_custody_slashing(spec, state):

View File

@@ -1,13 +1,12 @@
from eth2spec.test.context import (
PHASE0,
ALTAIR,
with_all_phases_except,
SHARDING,
with_phases,
spec_state_test,
)
from eth2spec.test.helpers.state import next_epoch
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([SHARDING])
@spec_state_test
def test_get_committee_count_delta(spec, state):
assert spec.get_committee_count_delta(state, 0, 0) == 0
@@ -24,7 +23,7 @@ def test_get_committee_count_delta(spec, state):
)
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([SHARDING])
@spec_state_test
def test_get_start_shard_current_epoch_start(spec, state):
assert state.current_epoch_start_shard == 0
@@ -40,7 +39,7 @@ def test_get_start_shard_current_epoch_start(spec, state):
assert start_shard == state.current_epoch_start_shard
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([SHARDING])
@spec_state_test
def test_get_start_shard_next_slot(spec, state):
next_epoch(spec, state)
@@ -58,7 +57,7 @@ def test_get_start_shard_next_slot(spec, state):
assert start_shard == expected_start_shard
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([SHARDING])
@spec_state_test
def test_get_start_shard_previous_slot(spec, state):
next_epoch(spec, state)
@@ -77,7 +76,7 @@ def test_get_start_shard_previous_slot(spec, state):
assert start_shard == expected_start_shard
@with_all_phases_except([PHASE0, ALTAIR])
@with_phases([SHARDING])
@spec_state_test
def test_get_start_shard_far_past_epoch(spec, state):
initial_epoch = spec.get_current_epoch(state)