Fix tests

This commit is contained in:
Hsiao-Wei Wang 2021-01-29 17:18:49 +08:00 committed by Danny Ryan
parent 007a6f0ecc
commit 6ce4b1b0e7
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 29 additions and 22 deletions

View File

@ -1,23 +1,30 @@
process_calls = [
# PHASE0
'process_justification_and_finalization',
'process_rewards_and_penalties',
'process_registry_updates',
'process_reveal_deadlines',
'process_challenge_deadlines',
'process_slashings',
'process_eth1_data_reset',
'process_effective_balance_updates',
'process_slashings_reset',
'process_randao_mixes_reset',
'process_historical_roots_update',
'process_participation_record_updates',
# LIGHTCLIENT_PATCH
'process_sync_committee_updates',
# PHASE1
'process_phase_1_final_updates',
]
from eth2spec.test.context import is_post_lightclient_patch
def get_process_calls(spec):
return [
# PHASE0
'process_justification_and_finalization',
'process_rewards_and_penalties',
'process_registry_updates',
'process_reveal_deadlines',
'process_challenge_deadlines',
'process_slashings',
'process_eth1_data_reset',
'process_effective_balance_updates',
'process_slashings_reset',
'process_randao_mixes_reset',
'process_historical_roots_update',
# 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):
@ -34,7 +41,7 @@ def run_epoch_processing_to(spec, state, process_name: str):
spec.process_slot(state)
# process components of epoch transition before final-updates
for name in process_calls:
for name in get_process_calls(spec):
if name == process_name:
break
# only run when present. Later phases introduce more to the epoch-processing.

View File

@ -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 (
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')
@with_all_phases
@with_phases([PHASE0])
@spec_state_test
def test_updated_participation_record(spec, state):
state.previous_epoch_attestations = [spec.PendingAttestation(proposer_index=100)]