Move over to parameterised decorators for phases
This commit is contained in:
parent
35c03c5f3e
commit
956c476d81
|
@ -90,33 +90,19 @@ def bls_switch(fn):
|
|||
return entry
|
||||
|
||||
|
||||
def with_phase0(fn):
|
||||
def with_phases(phases):
|
||||
"""
|
||||
Decorator to use phase 0's spec.
|
||||
Decorator factory that returns a decorator that runs a test for the appropriate phases
|
||||
"""
|
||||
def entry(*args, **kw):
|
||||
kw['spec'] = spec_phase0
|
||||
return fn(*args, **kw)
|
||||
return entry
|
||||
def decorator(fn):
|
||||
def run_with_spec_version(spec, *args, **kw):
|
||||
kw['spec'] = spec
|
||||
fn(*args, **kw)
|
||||
|
||||
|
||||
def with_phase1(fn):
|
||||
"""
|
||||
Decorator to use phase 1's spec
|
||||
"""
|
||||
def entry(*args, **kw):
|
||||
kw['spec'] = spec_phase1
|
||||
return fn(*args, **kw)
|
||||
return entry
|
||||
|
||||
|
||||
def with_all_phases(fn):
|
||||
"""
|
||||
Decorator to run everything with all available spec phases
|
||||
"""
|
||||
def entry(*args, **kw):
|
||||
kw['spec'] = spec_phase0
|
||||
fn(*args, **kw)
|
||||
kw['spec'] = spec_phase1
|
||||
fn(*args, **kw)
|
||||
return entry
|
||||
def wrapper(*args, **kw):
|
||||
if 'phase0' in phases:
|
||||
run_with_spec_version(spec_phase0, *args, **kw)
|
||||
if 'phase1' in phases:
|
||||
run_with_spec_version(spec_phase1, *args, **kw)
|
||||
return wrapper
|
||||
return decorator
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from copy import deepcopy
|
||||
|
||||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_all_phases, with_phase0
|
||||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_phases
|
||||
from eth2spec.test.helpers.attestations import (
|
||||
get_valid_attestation,
|
||||
sign_attestation,
|
||||
|
@ -47,7 +47,7 @@ def run_attestation_processing(spec, state, attestation, valid=True):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
|
@ -56,7 +56,7 @@ def test_success(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_previous_epoch(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
|
@ -66,7 +66,7 @@ def test_success_previous_epoch(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_since_max_epochs_per_crosslink(spec, state):
|
||||
for _ in range(spec.MAX_EPOCHS_PER_CROSSLINK + 2):
|
||||
|
@ -85,7 +85,7 @@ def test_success_since_max_epochs_per_crosslink(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_attestation_signature(spec, state):
|
||||
|
@ -95,7 +95,7 @@ def test_invalid_attestation_signature(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_before_inclusion_delay(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
|
@ -104,7 +104,7 @@ def test_before_inclusion_delay(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_after_epoch_slots(spec, state):
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
|
@ -115,7 +115,7 @@ def test_after_epoch_slots(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_old_source_epoch(spec, state):
|
||||
state.slot = spec.SLOTS_PER_EPOCH * 5
|
||||
|
@ -135,7 +135,7 @@ def test_old_source_epoch(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_wrong_shard(spec, state):
|
||||
attestation = get_valid_attestation(spec, state)
|
||||
|
@ -148,7 +148,7 @@ def test_wrong_shard(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_new_source_epoch(spec, state):
|
||||
attestation = get_valid_attestation(spec, state)
|
||||
|
@ -161,7 +161,7 @@ def test_new_source_epoch(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_source_root_is_target_root(spec, state):
|
||||
attestation = get_valid_attestation(spec, state)
|
||||
|
@ -174,7 +174,7 @@ def test_source_root_is_target_root(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_invalid_current_source_root(spec, state):
|
||||
state.slot = spec.SLOTS_PER_EPOCH * 5
|
||||
|
@ -201,7 +201,7 @@ def test_invalid_current_source_root(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_bad_source_root(spec, state):
|
||||
attestation = get_valid_attestation(spec, state)
|
||||
|
@ -214,7 +214,7 @@ def test_bad_source_root(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_phase0
|
||||
@with_phases(['phase0'])
|
||||
@spec_state_test
|
||||
def test_non_zero_crosslink_data_root(spec, state):
|
||||
attestation = get_valid_attestation(spec, state)
|
||||
|
@ -227,7 +227,7 @@ def test_non_zero_crosslink_data_root(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_bad_parent_crosslink(spec, state):
|
||||
next_epoch(spec, state)
|
||||
|
@ -243,7 +243,7 @@ def test_bad_parent_crosslink(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_bad_crosslink_start_epoch(spec, state):
|
||||
next_epoch(spec, state)
|
||||
|
@ -259,7 +259,7 @@ def test_bad_crosslink_start_epoch(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_bad_crosslink_end_epoch(spec, state):
|
||||
next_epoch(spec, state)
|
||||
|
@ -275,7 +275,7 @@ def test_bad_crosslink_end_epoch(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_inconsistent_bitfields(spec, state):
|
||||
attestation = get_valid_attestation(spec, state)
|
||||
|
@ -288,7 +288,7 @@ def test_inconsistent_bitfields(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_phase0
|
||||
@with_phases(['phase0'])
|
||||
@spec_state_test
|
||||
def test_non_empty_custody_bitfield(spec, state):
|
||||
attestation = get_valid_attestation(spec, state)
|
||||
|
@ -301,7 +301,7 @@ def test_non_empty_custody_bitfield(spec, state):
|
|||
yield from run_attestation_processing(spec, state, attestation, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_empty_aggregation_bitfield(spec, state):
|
||||
attestation = get_valid_attestation(spec, state)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_phases
|
||||
from eth2spec.test.helpers.attestations import sign_indexed_attestation
|
||||
from eth2spec.test.helpers.attester_slashings import get_valid_attester_slashing
|
||||
from eth2spec.test.helpers.block import apply_empty_block
|
||||
|
@ -54,7 +54,7 @@ def run_attester_slashing_processing(spec, state, attester_slashing, valid=True)
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_double(spec, state):
|
||||
attester_slashing = get_valid_attester_slashing(spec, state, signed_1=True, signed_2=True)
|
||||
|
@ -62,7 +62,7 @@ def test_success_double(spec, state):
|
|||
yield from run_attester_slashing_processing(spec, state, attester_slashing)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_surround(spec, state):
|
||||
next_epoch(spec, state)
|
||||
|
@ -80,7 +80,7 @@ def test_success_surround(spec, state):
|
|||
yield from run_attester_slashing_processing(spec, state, attester_slashing)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_sig_1(spec, state):
|
||||
|
@ -88,7 +88,7 @@ def test_invalid_sig_1(spec, state):
|
|||
yield from run_attester_slashing_processing(spec, state, attester_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_sig_2(spec, state):
|
||||
|
@ -96,7 +96,7 @@ def test_invalid_sig_2(spec, state):
|
|||
yield from run_attester_slashing_processing(spec, state, attester_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_sig_1_and_2(spec, state):
|
||||
|
@ -104,7 +104,7 @@ def test_invalid_sig_1_and_2(spec, state):
|
|||
yield from run_attester_slashing_processing(spec, state, attester_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_same_data(spec, state):
|
||||
attester_slashing = get_valid_attester_slashing(spec, state, signed_1=False, signed_2=True)
|
||||
|
@ -115,7 +115,7 @@ def test_same_data(spec, state):
|
|||
yield from run_attester_slashing_processing(spec, state, attester_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_no_double_or_surround(spec, state):
|
||||
attester_slashing = get_valid_attester_slashing(spec, state, signed_1=False, signed_2=True)
|
||||
|
@ -126,7 +126,7 @@ def test_no_double_or_surround(spec, state):
|
|||
yield from run_attester_slashing_processing(spec, state, attester_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_participants_already_slashed(spec, state):
|
||||
attester_slashing = get_valid_attester_slashing(spec, state, signed_1=True, signed_2=True)
|
||||
|
@ -140,7 +140,7 @@ def test_participants_already_slashed(spec, state):
|
|||
yield from run_attester_slashing_processing(spec, state, attester_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_custody_bit_0_and_1(spec, state):
|
||||
attester_slashing = get_valid_attester_slashing(spec, state, signed_1=False, signed_2=True)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from copy import deepcopy
|
||||
|
||||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_phases
|
||||
from eth2spec.test.helpers.block import (
|
||||
build_empty_block_for_next_slot,
|
||||
sign_block
|
||||
|
@ -34,14 +34,14 @@ def run_block_header_processing(spec, state, block, valid=True):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_block_header(spec, state):
|
||||
block = build_empty_block_for_next_slot(spec, state, signed=True)
|
||||
yield from run_block_header_processing(spec, state, block)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_sig_block_header(spec, state):
|
||||
|
@ -49,7 +49,7 @@ def test_invalid_sig_block_header(spec, state):
|
|||
yield from run_block_header_processing(spec, state, block, valid=False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_invalid_slot_block_header(spec, state):
|
||||
block = build_empty_block_for_next_slot(spec, state)
|
||||
|
@ -59,7 +59,7 @@ def test_invalid_slot_block_header(spec, state):
|
|||
yield from run_block_header_processing(spec, state, block, valid=False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_invalid_parent_root(spec, state):
|
||||
block = build_empty_block_for_next_slot(spec, state)
|
||||
|
@ -69,7 +69,7 @@ def test_invalid_parent_root(spec, state):
|
|||
yield from run_block_header_processing(spec, state, block, valid=False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_proposer_slashed(spec, state):
|
||||
# use stub state to get proposer index of next slot
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_phases
|
||||
from eth2spec.test.helpers.deposits import (
|
||||
build_deposit,
|
||||
prepare_state_and_deposit,
|
||||
|
@ -52,7 +52,7 @@ def run_deposit_processing(spec, state, deposit, validator_index, valid=True, ef
|
|||
assert state.deposit_index == state.latest_eth1_data.deposit_count
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_new_deposit(spec, state):
|
||||
# fresh deposit = next validator index = validator appended to registry
|
||||
|
@ -63,7 +63,7 @@ def test_new_deposit(spec, state):
|
|||
yield from run_deposit_processing(spec, state, deposit, validator_index)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_sig_new_deposit(spec, state):
|
||||
|
@ -74,7 +74,7 @@ def test_invalid_sig_new_deposit(spec, state):
|
|||
yield from run_deposit_processing(spec, state, deposit, validator_index, valid=True, effective=False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_top_up(spec, state):
|
||||
validator_index = 0
|
||||
|
@ -84,7 +84,7 @@ def test_success_top_up(spec, state):
|
|||
yield from run_deposit_processing(spec, state, deposit, validator_index)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_sig_top_up(spec, state):
|
||||
|
@ -96,7 +96,7 @@ def test_invalid_sig_top_up(spec, state):
|
|||
yield from run_deposit_processing(spec, state, deposit, validator_index, valid=True, effective=True)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_invalid_withdrawal_credentials_top_up(spec, state):
|
||||
validator_index = 0
|
||||
|
@ -114,7 +114,7 @@ def test_invalid_withdrawal_credentials_top_up(spec, state):
|
|||
yield from run_deposit_processing(spec, state, deposit, validator_index, valid=True, effective=True)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_wrong_index(spec, state):
|
||||
validator_index = len(state.validator_registry)
|
||||
|
@ -129,7 +129,7 @@ def test_wrong_index(spec, state):
|
|||
yield from run_deposit_processing(spec, state, deposit, validator_index, valid=False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_wrong_deposit_for_deposit_count(spec, state):
|
||||
deposit_data_leaves = [spec.ZERO_HASH] * len(state.validator_registry)
|
||||
|
@ -175,7 +175,7 @@ def test_wrong_deposit_for_deposit_count(spec, state):
|
|||
# TODO: test invalid signature
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_bad_merkle_proof(spec, state):
|
||||
validator_index = len(state.validator_registry)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_phases
|
||||
from eth2spec.test.helpers.block_header import sign_block_header
|
||||
from eth2spec.test.helpers.keys import privkeys
|
||||
from eth2spec.test.helpers.proposer_slashings import get_valid_proposer_slashing
|
||||
|
@ -40,7 +40,7 @@ def run_proposer_slashing_processing(spec, state, proposer_slashing, valid=True)
|
|||
)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success(spec, state):
|
||||
proposer_slashing = get_valid_proposer_slashing(spec, state, signed_1=True, signed_2=True)
|
||||
|
@ -48,7 +48,7 @@ def test_success(spec, state):
|
|||
yield from run_proposer_slashing_processing(spec, state, proposer_slashing)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_sig_1(spec, state):
|
||||
|
@ -56,7 +56,7 @@ def test_invalid_sig_1(spec, state):
|
|||
yield from run_proposer_slashing_processing(spec, state, proposer_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_sig_2(spec, state):
|
||||
|
@ -64,7 +64,7 @@ def test_invalid_sig_2(spec, state):
|
|||
yield from run_proposer_slashing_processing(spec, state, proposer_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_sig_1_and_2(spec, state):
|
||||
|
@ -72,7 +72,7 @@ def test_invalid_sig_1_and_2(spec, state):
|
|||
yield from run_proposer_slashing_processing(spec, state, proposer_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_invalid_proposer_index(spec, state):
|
||||
proposer_slashing = get_valid_proposer_slashing(spec, state, signed_1=True, signed_2=True)
|
||||
|
@ -82,7 +82,7 @@ def test_invalid_proposer_index(spec, state):
|
|||
yield from run_proposer_slashing_processing(spec, state, proposer_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_epochs_are_different(spec, state):
|
||||
proposer_slashing = get_valid_proposer_slashing(spec, state, signed_1=True, signed_2=False)
|
||||
|
@ -94,7 +94,7 @@ def test_epochs_are_different(spec, state):
|
|||
yield from run_proposer_slashing_processing(spec, state, proposer_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_headers_are_same(spec, state):
|
||||
proposer_slashing = get_valid_proposer_slashing(spec, state, signed_1=True, signed_2=False)
|
||||
|
@ -105,7 +105,7 @@ def test_headers_are_same(spec, state):
|
|||
yield from run_proposer_slashing_processing(spec, state, proposer_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_proposer_is_not_activated(spec, state):
|
||||
proposer_slashing = get_valid_proposer_slashing(spec, state, signed_1=True, signed_2=True)
|
||||
|
@ -116,7 +116,7 @@ def test_proposer_is_not_activated(spec, state):
|
|||
yield from run_proposer_slashing_processing(spec, state, proposer_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_proposer_is_slashed(spec, state):
|
||||
proposer_slashing = get_valid_proposer_slashing(spec, state, signed_1=True, signed_2=True)
|
||||
|
@ -127,7 +127,7 @@ def test_proposer_is_slashed(spec, state):
|
|||
yield from run_proposer_slashing_processing(spec, state, proposer_slashing, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_proposer_is_withdrawn(spec, state):
|
||||
proposer_slashing = get_valid_proposer_slashing(spec, state, signed_1=True, signed_2=True)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_phases
|
||||
from eth2spec.test.helpers.state import next_epoch
|
||||
from eth2spec.test.helpers.block import apply_empty_block
|
||||
from eth2spec.test.helpers.transfers import get_valid_transfer
|
||||
|
@ -36,7 +36,7 @@ def run_transfer_processing(spec, state, transfer, valid=True):
|
|||
assert state.balances[proposer_index] == pre_transfer_proposer_balance + transfer.fee
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_non_activated(spec, state):
|
||||
transfer = get_valid_transfer(spec, state, signed=True)
|
||||
|
@ -46,7 +46,7 @@ def test_success_non_activated(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_withdrawable(spec, state):
|
||||
next_epoch(spec, state)
|
||||
|
@ -60,7 +60,7 @@ def test_success_withdrawable(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_active_above_max_effective(spec, state):
|
||||
sender_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1]
|
||||
|
@ -70,7 +70,7 @@ def test_success_active_above_max_effective(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_active_above_max_effective_fee(spec, state):
|
||||
sender_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1]
|
||||
|
@ -80,7 +80,7 @@ def test_success_active_above_max_effective_fee(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_signature(spec, state):
|
||||
|
@ -91,7 +91,7 @@ def test_invalid_signature(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_active_but_transfer_past_effective_balance(spec, state):
|
||||
sender_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1]
|
||||
|
@ -102,7 +102,7 @@ def test_active_but_transfer_past_effective_balance(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_incorrect_slot(spec, state):
|
||||
transfer = get_valid_transfer(spec, state, slot=state.slot + 1, signed=True)
|
||||
|
@ -112,7 +112,7 @@ def test_incorrect_slot(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_insufficient_balance_for_fee(spec, state):
|
||||
sender_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1]
|
||||
|
@ -125,7 +125,7 @@ def test_insufficient_balance_for_fee(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_insufficient_balance(spec, state):
|
||||
sender_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1]
|
||||
|
@ -138,7 +138,7 @@ def test_insufficient_balance(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_no_dust_sender(spec, state):
|
||||
sender_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1]
|
||||
|
@ -158,7 +158,7 @@ def test_no_dust_sender(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_no_dust_recipient(spec, state):
|
||||
sender_index = spec.get_active_validator_indices(state, spec.get_current_epoch(state))[-1]
|
||||
|
@ -172,7 +172,7 @@ def test_no_dust_recipient(spec, state):
|
|||
yield from run_transfer_processing(spec, state, transfer, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_invalid_pubkey(spec, state):
|
||||
transfer = get_valid_transfer(spec, state, signed=True)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, expect_assertion_error, always_bls, with_phases
|
||||
from eth2spec.test.helpers.keys import pubkey_to_privkey
|
||||
from eth2spec.test.helpers.voluntary_exits import build_voluntary_exit, sign_voluntary_exit
|
||||
|
||||
|
@ -31,7 +31,7 @@ def run_voluntary_exit_processing(spec, state, voluntary_exit, valid=True):
|
|||
assert state.validator_registry[validator_index].exit_epoch < spec.FAR_FUTURE_EPOCH
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success(spec, state):
|
||||
# move state forward PERSISTENT_COMMITTEE_PERIOD epochs to allow for exit
|
||||
|
@ -46,7 +46,7 @@ def test_success(spec, state):
|
|||
yield from run_voluntary_exit_processing(spec, state, voluntary_exit)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@always_bls
|
||||
@spec_state_test
|
||||
def test_invalid_signature(spec, state):
|
||||
|
@ -62,7 +62,7 @@ def test_invalid_signature(spec, state):
|
|||
yield from run_voluntary_exit_processing(spec, state, voluntary_exit, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_success_exit_queue(spec, state):
|
||||
# move state forward PERSISTENT_COMMITTEE_PERIOD epochs to allow for exit
|
||||
|
@ -114,7 +114,7 @@ def test_success_exit_queue(spec, state):
|
|||
)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_validator_exit_in_future(spec, state):
|
||||
# move state forward PERSISTENT_COMMITTEE_PERIOD epochs to allow for exit
|
||||
|
@ -138,7 +138,7 @@ def test_validator_exit_in_future(spec, state):
|
|||
yield from run_voluntary_exit_processing(spec, state, voluntary_exit, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_validator_invalid_validator_index(spec, state):
|
||||
# move state forward PERSISTENT_COMMITTEE_PERIOD epochs to allow for exit
|
||||
|
@ -162,7 +162,7 @@ def test_validator_invalid_validator_index(spec, state):
|
|||
yield from run_voluntary_exit_processing(spec, state, voluntary_exit, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_validator_not_active(spec, state):
|
||||
current_epoch = spec.get_current_epoch(state)
|
||||
|
@ -184,7 +184,7 @@ def test_validator_not_active(spec, state):
|
|||
yield from run_voluntary_exit_processing(spec, state, voluntary_exit, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_validator_already_exited(spec, state):
|
||||
# move state forward PERSISTENT_COMMITTEE_PERIOD epochs to allow validator able to exit
|
||||
|
@ -209,7 +209,7 @@ def test_validator_already_exited(spec, state):
|
|||
yield from run_voluntary_exit_processing(spec, state, voluntary_exit, False)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_validator_not_active_long_enough(spec, state):
|
||||
current_epoch = spec.get_current_epoch(state)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from copy import deepcopy
|
||||
|
||||
from eth2spec.test.context import spec_state_test, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, with_phases
|
||||
from eth2spec.test.helpers.state import (
|
||||
next_epoch,
|
||||
next_slot
|
||||
|
@ -37,7 +37,7 @@ def run_process_crosslinks(spec, state, valid=True):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_no_attestations(spec, state):
|
||||
yield from run_process_crosslinks(spec, state)
|
||||
|
@ -46,7 +46,7 @@ def test_no_attestations(spec, state):
|
|||
assert state.previous_crosslinks[shard] == state.current_crosslinks[shard]
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_single_crosslink_update_from_current_epoch(spec, state):
|
||||
next_epoch(spec, state)
|
||||
|
@ -67,7 +67,7 @@ def test_single_crosslink_update_from_current_epoch(spec, state):
|
|||
assert pre_crosslink != state.current_crosslinks[shard]
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_single_crosslink_update_from_previous_epoch(spec, state):
|
||||
next_epoch(spec, state)
|
||||
|
@ -98,7 +98,7 @@ def test_single_crosslink_update_from_previous_epoch(spec, state):
|
|||
assert crosslink_deltas[1][index] == 0
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_double_late_crosslink(spec, state):
|
||||
if spec.get_epoch_committee_count(state, spec.get_current_epoch(state)) < spec.SHARD_COUNT:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from eth2spec.phase0.spec import state_transition
|
||||
from eth2spec.test.helpers.block import build_empty_block_for_next_slot, sign_block
|
||||
from eth2spec.test.helpers.state import next_epoch
|
||||
from eth2spec.test.context import spec_state_test, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, with_phases
|
||||
|
||||
|
||||
def run_process_registry_updates(spec, state, valid=True):
|
||||
|
@ -31,7 +31,7 @@ def run_process_registry_updates(spec, state, valid=True):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_activation(spec, state):
|
||||
index = 0
|
||||
|
@ -56,7 +56,7 @@ def test_activation(spec, state):
|
|||
)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_ejection(spec, state):
|
||||
index = 0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from eth2spec.test.helpers.custody import get_valid_early_derived_secret_reveal
|
||||
from eth2spec.test.helpers.block import apply_empty_block
|
||||
from eth2spec.test.helpers.state import next_epoch, get_balance
|
||||
from eth2spec.test.context import with_phase1, spec_state_test, expect_assertion_error
|
||||
from eth2spec.test.context import with_phases, spec_state_test, expect_assertion_error
|
||||
|
||||
|
||||
def run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, valid=True):
|
||||
|
@ -35,7 +35,7 @@ def run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, v
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_phase1
|
||||
@with_phases(['phase1'])
|
||||
@spec_state_test
|
||||
def test_success(spec, state):
|
||||
randao_key_reveal = get_valid_early_derived_secret_reveal(spec, state)
|
||||
|
@ -43,7 +43,7 @@ def test_success(spec, state):
|
|||
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal)
|
||||
|
||||
|
||||
@with_phase1
|
||||
@with_phases(['phase1'])
|
||||
@spec_state_test
|
||||
def test_reveal_from_current_epoch(spec, state):
|
||||
randao_key_reveal = get_valid_early_derived_secret_reveal(spec, state, spec.get_current_epoch(state))
|
||||
|
@ -51,7 +51,7 @@ def test_reveal_from_current_epoch(spec, state):
|
|||
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
|
||||
|
||||
|
||||
@with_phase1
|
||||
@with_phases(['phase1'])
|
||||
@spec_state_test
|
||||
def test_reveal_from_past_epoch(spec, state):
|
||||
next_epoch(spec, state)
|
||||
|
@ -61,7 +61,7 @@ def test_reveal_from_past_epoch(spec, state):
|
|||
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
|
||||
|
||||
|
||||
@with_phase1
|
||||
@with_phases(['phase1'])
|
||||
@spec_state_test
|
||||
def test_reveal_with_custody_padding(spec, state):
|
||||
randao_key_reveal = get_valid_early_derived_secret_reveal(
|
||||
|
@ -72,7 +72,7 @@ def test_reveal_with_custody_padding(spec, state):
|
|||
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, True)
|
||||
|
||||
|
||||
@with_phase1
|
||||
@with_phases(['phase1'])
|
||||
@spec_state_test
|
||||
def test_reveal_with_custody_padding_minus_one(spec, state):
|
||||
randao_key_reveal = get_valid_early_derived_secret_reveal(
|
||||
|
@ -83,7 +83,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_phase1
|
||||
@with_phases(['phase1'])
|
||||
@spec_state_test
|
||||
def test_double_reveal(spec, state):
|
||||
randao_key_reveal1 = get_valid_early_derived_secret_reveal(
|
||||
|
@ -107,7 +107,7 @@ def test_double_reveal(spec, state):
|
|||
yield 'post', post_state
|
||||
|
||||
|
||||
@with_phase1
|
||||
@with_phases(['phase1'])
|
||||
@spec_state_test
|
||||
def test_revealer_is_slashed(spec, state):
|
||||
randao_key_reveal = get_valid_early_derived_secret_reveal(spec, state, spec.get_current_epoch(state))
|
||||
|
@ -116,7 +116,7 @@ def test_revealer_is_slashed(spec, state):
|
|||
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
|
||||
|
||||
|
||||
@with_phase1
|
||||
@with_phases(['phase1'])
|
||||
@spec_state_test
|
||||
def test_far_future_epoch(spec, state):
|
||||
randao_key_reveal = get_valid_early_derived_secret_reveal(
|
||||
|
|
|
@ -13,10 +13,10 @@ from eth2spec.test.helpers.proposer_slashings import get_valid_proposer_slashing
|
|||
from eth2spec.test.helpers.attestations import get_valid_attestation
|
||||
from eth2spec.test.helpers.deposits import prepare_state_and_deposit
|
||||
|
||||
from eth2spec.test.context import spec_state_test, never_bls, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, never_bls, with_phases
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@never_bls
|
||||
@spec_state_test
|
||||
def test_empty_block_transition(spec, state):
|
||||
|
@ -35,7 +35,7 @@ def test_empty_block_transition(spec, state):
|
|||
assert spec.get_block_root_at_slot(state, pre_slot) == block.parent_root
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@never_bls
|
||||
@spec_state_test
|
||||
def test_skipped_slots(spec, state):
|
||||
|
@ -55,7 +55,7 @@ def test_skipped_slots(spec, state):
|
|||
assert spec.get_block_root_at_slot(state, slot) == block.parent_root
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_empty_epoch_transition(spec, state):
|
||||
pre_slot = state.slot
|
||||
|
@ -74,7 +74,7 @@ def test_empty_epoch_transition(spec, state):
|
|||
assert spec.get_block_root_at_slot(state, slot) == block.parent_root
|
||||
|
||||
|
||||
# @with_all_phases
|
||||
# @with_phases(['phase0', 'phase1'])
|
||||
# @spec_state_test
|
||||
# def test_empty_epoch_transition_not_finalizing(spec, state):
|
||||
# # copy for later balance lookups.
|
||||
|
@ -95,7 +95,7 @@ def test_empty_epoch_transition(spec, state):
|
|||
# assert get_balance(state, index) < get_balance(pre_state, index)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_proposer_slashing(spec, state):
|
||||
# copy for later balance lookups.
|
||||
|
@ -127,7 +127,7 @@ def test_proposer_slashing(spec, state):
|
|||
assert get_balance(state, validator_index) < get_balance(pre_state, validator_index)
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_attester_slashing(spec, state):
|
||||
# copy for later balance lookups.
|
||||
|
@ -169,7 +169,7 @@ def test_attester_slashing(spec, state):
|
|||
|
||||
# TODO update functions below to be like above, i.e. with @spec_state_test and yielding data to put into the test vector
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_deposit_in_block(spec, state):
|
||||
initial_registry_len = len(state.validator_registry)
|
||||
|
@ -196,7 +196,7 @@ def test_deposit_in_block(spec, state):
|
|||
assert state.validator_registry[validator_index].pubkey == pubkeys[validator_index]
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_deposit_top_up(spec, state):
|
||||
validator_index = 0
|
||||
|
@ -223,7 +223,7 @@ def test_deposit_top_up(spec, state):
|
|||
assert get_balance(state, validator_index) == validator_pre_balance + amount
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_attestation(spec, state):
|
||||
state.slot = spec.SLOTS_PER_EPOCH
|
||||
|
@ -257,7 +257,7 @@ def test_attestation(spec, state):
|
|||
assert spec.hash_tree_root(state.previous_epoch_attestations) == pre_current_attestations_root
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_voluntary_exit(spec, state):
|
||||
validator_index = spec.get_active_validator_indices(
|
||||
|
@ -303,7 +303,7 @@ def test_voluntary_exit(spec, state):
|
|||
assert state.validator_registry[validator_index].exit_epoch < spec.FAR_FUTURE_EPOCH
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_transfer(spec, state):
|
||||
# overwrite default 0 to test
|
||||
|
@ -337,7 +337,7 @@ def test_transfer(spec, state):
|
|||
assert recipient_balance == pre_transfer_recipient_balance + amount
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_balance_driven_status_transitions(spec, state):
|
||||
current_epoch = spec.get_current_epoch(state)
|
||||
|
@ -362,7 +362,7 @@ def test_balance_driven_status_transitions(spec, state):
|
|||
assert state.validator_registry[validator_index].exit_epoch < spec.FAR_FUTURE_EPOCH
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_historical_batch(spec, state):
|
||||
state.slot += spec.SLOTS_PER_HISTORICAL_ROOT - (state.slot % spec.SLOTS_PER_HISTORICAL_ROOT) - 1
|
||||
|
@ -381,7 +381,7 @@ def test_historical_batch(spec, state):
|
|||
assert len(state.historical_roots) == pre_historical_roots_len + 1
|
||||
|
||||
|
||||
# @with_all_phases
|
||||
# @with_phases(['phase0', 'phase1'])
|
||||
# @spec_state_test
|
||||
# def test_eth1_data_votes(spec, state):
|
||||
# yield 'pre', state
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from eth2spec.test.helpers.state import get_state_root
|
||||
from eth2spec.test.context import spec_state_test, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, with_phases
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_slots_1(spec, state):
|
||||
pre_slot = state.slot
|
||||
|
@ -18,7 +18,7 @@ def test_slots_1(spec, state):
|
|||
assert get_state_root(spec, state, pre_slot) == pre_root
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_slots_2(spec, state):
|
||||
yield 'pre', state
|
||||
|
@ -28,7 +28,7 @@ def test_slots_2(spec, state):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_empty_epoch(spec, state):
|
||||
yield 'pre', state
|
||||
|
@ -38,7 +38,7 @@ def test_empty_epoch(spec, state):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_double_empty_epoch(spec, state):
|
||||
yield 'pre', state
|
||||
|
@ -48,7 +48,7 @@ def test_double_empty_epoch(spec, state):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@spec_state_test
|
||||
def test_over_epoch_boundary(spec, state):
|
||||
spec.process_slots(state, state.slot + (spec.SLOTS_PER_EPOCH // 2))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from copy import deepcopy
|
||||
from typing import List
|
||||
|
||||
from eth2spec.test.context import spec_state_test, never_bls, with_all_phases
|
||||
from eth2spec.test.context import spec_state_test, never_bls, with_phases
|
||||
from eth2spec.test.helpers.state import next_epoch
|
||||
from eth2spec.test.helpers.block import build_empty_block_for_next_slot, apply_empty_block
|
||||
from eth2spec.test.helpers.attestations import get_valid_attestation
|
||||
|
@ -60,7 +60,7 @@ def next_epoch_with_attestations(spec,
|
|||
return state, blocks, post_state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@never_bls
|
||||
@spec_state_test
|
||||
def test_finality_rule_4(spec, state):
|
||||
|
@ -89,7 +89,7 @@ def test_finality_rule_4(spec, state):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@never_bls
|
||||
@spec_state_test
|
||||
def test_finality_rule_1(spec, state):
|
||||
|
@ -120,7 +120,7 @@ def test_finality_rule_1(spec, state):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@never_bls
|
||||
@spec_state_test
|
||||
def test_finality_rule_2(spec, state):
|
||||
|
@ -153,7 +153,7 @@ def test_finality_rule_2(spec, state):
|
|||
yield 'post', state
|
||||
|
||||
|
||||
@with_all_phases
|
||||
@with_phases(['phase0', 'phase1'])
|
||||
@never_bls
|
||||
@spec_state_test
|
||||
def test_finality_rule_3(spec, state):
|
||||
|
|
Loading…
Reference in New Issue