mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-01 17:14:55 -05:00
Consistently use compute_sync_committee_period
There were a couple instances where a division was used on an epoch to derive the corresponding sync committee period instead of calling the `compute_sync_committee_period` function. These instances were changed to also use the function.
This commit is contained in:
@@ -24,7 +24,7 @@ def run_sync_committees_progress_test(spec, state):
|
||||
first_sync_committee = state.current_sync_committee.copy()
|
||||
second_sync_committee = state.next_sync_committee.copy()
|
||||
|
||||
current_period = spec.get_current_epoch(state) // spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||
current_period = spec.compute_sync_committee_period(spec.get_current_epoch(state))
|
||||
next_period = current_period + 1
|
||||
next_period_start_epoch = next_period * spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||
next_period_start_slot = next_period_start_epoch * spec.SLOTS_PER_EPOCH
|
||||
|
||||
@@ -98,8 +98,8 @@ def test_process_light_client_update_timeout(spec, state):
|
||||
|
||||
# Forward to next sync committee period
|
||||
next_slots(spec, state, spec.UPDATE_TIMEOUT)
|
||||
snapshot_period = spec.compute_epoch_at_slot(store.optimistic_header.slot) // spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||
update_period = spec.compute_epoch_at_slot(state.slot) // spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||
snapshot_period = spec.compute_sync_committee_period(spec.compute_epoch_at_slot(store.optimistic_header.slot))
|
||||
update_period = spec.compute_sync_committee_period(spec.compute_epoch_at_slot(state.slot))
|
||||
assert snapshot_period + 1 == update_period
|
||||
|
||||
block = build_empty_block_for_next_slot(spec, state)
|
||||
@@ -169,8 +169,8 @@ def test_process_light_client_update_finality_updated(spec, state):
|
||||
# Ensure that finality checkpoint has changed
|
||||
assert state.finalized_checkpoint.epoch == 3
|
||||
# Ensure that it's same period
|
||||
snapshot_period = spec.compute_epoch_at_slot(store.optimistic_header.slot) // spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||
update_period = spec.compute_epoch_at_slot(state.slot) // spec.EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||
snapshot_period = spec.compute_sync_committee_period(spec.compute_epoch_at_slot(store.optimistic_header.slot))
|
||||
update_period = spec.compute_sync_committee_period(spec.compute_epoch_at_slot(state.slot))
|
||||
assert snapshot_period == update_period
|
||||
|
||||
# Updated sync_committee and finality
|
||||
|
||||
Reference in New Issue
Block a user