fix genesis tests: only run on single phase, ignore phases extra data

This commit is contained in:
protolambda 2020-01-06 00:57:36 +01:00
parent ba10046cc1
commit cd7a2149f9
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
2 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,4 @@
from eth2spec.test.context import spec_test, with_phases
from eth2spec.test.context import spec_test, with_phases, single_phase
from eth2spec.test.helpers.deposits import (
prepare_genesis_deposits,
)
@ -6,6 +6,7 @@ from eth2spec.test.helpers.deposits import (
@with_phases(['phase0'])
@spec_test
@single_phase
def test_initialize_beacon_state_from_eth1(spec):
deposit_count = spec.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT
deposits, deposit_root, _ = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE, signed=True)
@ -33,6 +34,7 @@ def test_initialize_beacon_state_from_eth1(spec):
@with_phases(['phase0'])
@spec_test
@single_phase
def test_initialize_beacon_state_some_small_balances(spec):
main_deposit_count = spec.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT
main_deposits, _, deposit_data_list = prepare_genesis_deposits(spec, main_deposit_count,

View File

@ -1,4 +1,4 @@
from eth2spec.test.context import spec_test, with_phases
from eth2spec.test.context import spec_test, with_phases, single_phase
from eth2spec.test.helpers.deposits import (
prepare_genesis_deposits,
)
@ -27,6 +27,7 @@ def run_is_valid_genesis_state(spec, state, valid=True):
@with_phases(['phase0'])
@spec_test
@single_phase
def test_is_valid_genesis_state_true(spec):
state = create_valid_beacon_state(spec)
@ -35,6 +36,7 @@ def test_is_valid_genesis_state_true(spec):
@with_phases(['phase0'])
@spec_test
@single_phase
def test_is_valid_genesis_state_false_invalid_timestamp(spec):
state = create_valid_beacon_state(spec)
state.genesis_time = spec.MIN_GENESIS_TIME - 1
@ -44,6 +46,7 @@ def test_is_valid_genesis_state_false_invalid_timestamp(spec):
@with_phases(['phase0'])
@spec_test
@single_phase
def test_is_valid_genesis_state_true_more_balance(spec):
state = create_valid_beacon_state(spec)
state.validators[0].effective_balance = spec.MAX_EFFECTIVE_BALANCE + 1
@ -63,6 +66,7 @@ def test_is_valid_genesis_state_true_more_balance(spec):
@with_phases(['phase0'])
@spec_test
@single_phase
def test_is_valid_genesis_state_true_one_more_validator(spec):
deposit_count = spec.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT + 1
deposits, _, _ = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE, signed=True)
@ -76,6 +80,7 @@ def test_is_valid_genesis_state_true_one_more_validator(spec):
@with_phases(['phase0'])
@spec_test
@single_phase
def test_is_valid_genesis_state_false_not_enough_validator(spec):
deposit_count = spec.MIN_GENESIS_ACTIVE_VALIDATOR_COUNT - 1
deposits, _, _ = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE, signed=True)