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,5 +1,9 @@
process_calls = [ from eth2spec.test.context import is_post_lightclient_patch
def get_process_calls(spec):
return [
# PHASE0 # PHASE0
'process_justification_and_finalization', 'process_justification_and_finalization',
'process_rewards_and_penalties', 'process_rewards_and_penalties',
@ -12,8 +16,11 @@ process_calls = [
'process_slashings_reset', 'process_slashings_reset',
'process_randao_mixes_reset', 'process_randao_mixes_reset',
'process_historical_roots_update', 'process_historical_roots_update',
'process_participation_record_updates', # LIGHTCLIENT_PATCH replaced `process_participation_record_updates` with
# LIGHTCLIENT_PATCH # `process_epoch_participation_updates`
'process_epoch_participation_updates' if is_post_lightclient_patch(spec) else (
'process_participation_record_updates'
),
'process_sync_committee_updates', 'process_sync_committee_updates',
# PHASE1 # PHASE1
'process_phase_1_final_updates', 'process_phase_1_final_updates',
@ -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.

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 ( 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)]