Merge pull request #3571 from etan-status/lc-periodhelpers
Extract sync committee period <-> slot helpers to common LC test module
This commit is contained in:
commit
e42974ef03
|
@ -28,6 +28,7 @@ from eth2spec.test.helpers.forks import (
|
|||
is_post_fork,
|
||||
)
|
||||
from eth2spec.test.helpers.light_client import (
|
||||
compute_start_slot_at_next_sync_committee_period,
|
||||
get_sync_aggregate,
|
||||
upgrade_lc_bootstrap_to_new_spec,
|
||||
upgrade_lc_update_to_new_spec,
|
||||
|
@ -196,15 +197,6 @@ def emit_upgrade_store(test, new_s_spec, phases=None):
|
|||
})
|
||||
|
||||
|
||||
def compute_start_slot_at_sync_committee_period(spec, sync_committee_period):
|
||||
return spec.compute_start_slot_at_epoch(sync_committee_period * spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD)
|
||||
|
||||
|
||||
def compute_start_slot_at_next_sync_committee_period(spec, state):
|
||||
sync_committee_period = spec.compute_sync_committee_period_at_slot(state.slot)
|
||||
return compute_start_slot_at_sync_committee_period(spec, sync_committee_period + 1)
|
||||
|
||||
|
||||
@with_light_client
|
||||
@spec_state_test_with_matching_config
|
||||
@with_presets([MINIMAL], reason="too slow")
|
||||
|
|
|
@ -11,6 +11,15 @@ from eth2spec.test.helpers.sync_committee import (
|
|||
from math import floor
|
||||
|
||||
|
||||
def compute_start_slot_at_sync_committee_period(spec, sync_committee_period):
|
||||
return spec.compute_start_slot_at_epoch(sync_committee_period * spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD)
|
||||
|
||||
|
||||
def compute_start_slot_at_next_sync_committee_period(spec, state):
|
||||
sync_committee_period = spec.compute_sync_committee_period_at_slot(state.slot)
|
||||
return compute_start_slot_at_sync_committee_period(spec, sync_committee_period + 1)
|
||||
|
||||
|
||||
def get_sync_aggregate(spec, state, num_participants=None, signature_slot=None):
|
||||
# By default, the sync committee signs the previous slot
|
||||
if signature_slot is None:
|
||||
|
|
Loading…
Reference in New Issue