Fix tests
This commit is contained in:
parent
007a6f0ecc
commit
6ce4b1b0e7
|
@ -1,23 +1,30 @@
|
||||||
|
|
||||||
process_calls = [
|
from eth2spec.test.context import is_post_lightclient_patch
|
||||||
# PHASE0
|
|
||||||
'process_justification_and_finalization',
|
|
||||||
'process_rewards_and_penalties',
|
def get_process_calls(spec):
|
||||||
'process_registry_updates',
|
return [
|
||||||
'process_reveal_deadlines',
|
# PHASE0
|
||||||
'process_challenge_deadlines',
|
'process_justification_and_finalization',
|
||||||
'process_slashings',
|
'process_rewards_and_penalties',
|
||||||
'process_eth1_data_reset',
|
'process_registry_updates',
|
||||||
'process_effective_balance_updates',
|
'process_reveal_deadlines',
|
||||||
'process_slashings_reset',
|
'process_challenge_deadlines',
|
||||||
'process_randao_mixes_reset',
|
'process_slashings',
|
||||||
'process_historical_roots_update',
|
'process_eth1_data_reset',
|
||||||
'process_participation_record_updates',
|
'process_effective_balance_updates',
|
||||||
# LIGHTCLIENT_PATCH
|
'process_slashings_reset',
|
||||||
'process_sync_committee_updates',
|
'process_randao_mixes_reset',
|
||||||
# PHASE1
|
'process_historical_roots_update',
|
||||||
'process_phase_1_final_updates',
|
# LIGHTCLIENT_PATCH replaced `process_participation_record_updates` with
|
||||||
]
|
# `process_epoch_participation_updates`
|
||||||
|
'process_epoch_participation_updates' if is_post_lightclient_patch(spec) else (
|
||||||
|
'process_participation_record_updates'
|
||||||
|
),
|
||||||
|
'process_sync_committee_updates',
|
||||||
|
# PHASE1
|
||||||
|
'process_phase_1_final_updates',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def run_epoch_processing_to(spec, state, process_name: str):
|
def run_epoch_processing_to(spec, state, process_name: str):
|
||||||
|
@ -34,7 +41,7 @@ def run_epoch_processing_to(spec, state, process_name: str):
|
||||||
spec.process_slot(state)
|
spec.process_slot(state)
|
||||||
|
|
||||||
# process components of epoch transition before final-updates
|
# process components of epoch transition before final-updates
|
||||||
for name in process_calls:
|
for name in get_process_calls(spec):
|
||||||
if name == process_name:
|
if name == process_name:
|
||||||
break
|
break
|
||||||
# only run when present. Later phases introduce more to the epoch-processing.
|
# only run when present. Later phases introduce more to the epoch-processing.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from eth2spec.test.context import spec_state_test, with_all_phases
|
from eth2spec.test.context import PHASE0, spec_state_test, with_phases
|
||||||
from eth2spec.test.helpers.epoch_processing import (
|
from eth2spec.test.helpers.epoch_processing import (
|
||||||
run_epoch_processing_with
|
run_epoch_processing_with
|
||||||
)
|
)
|
||||||
|
@ -8,7 +8,7 @@ def run_process_participation_record_updates(spec, state):
|
||||||
yield from run_epoch_processing_with(spec, state, 'process_participation_record_updates')
|
yield from run_epoch_processing_with(spec, state, 'process_participation_record_updates')
|
||||||
|
|
||||||
|
|
||||||
@with_all_phases
|
@with_phases([PHASE0])
|
||||||
@spec_state_test
|
@spec_state_test
|
||||||
def test_updated_participation_record(spec, state):
|
def test_updated_participation_record(spec, state):
|
||||||
state.previous_epoch_attestations = [spec.PendingAttestation(proposer_index=100)]
|
state.previous_epoch_attestations = [spec.PendingAttestation(proposer_index=100)]
|
||||||
|
|
Loading…
Reference in New Issue