use current_Epoch seed when calculating next_sync_committee
This commit is contained in:
parent
5074fcad17
commit
2747882776
|
@ -304,7 +304,7 @@ def get_sync_committee_indices(state: BeaconState, epoch: Epoch) -> Sequence[Val
|
|||
```python
|
||||
def get_sync_committee(state: BeaconState, epoch: Epoch) -> SyncCommittee:
|
||||
"""
|
||||
Return the sync committee for a given ``state`` and ``epoch``.
|
||||
Return the *next* sync committee for a given ``state`` and ``epoch``.
|
||||
|
||||
``SyncCommittee`` contains an aggregate pubkey that enables
|
||||
resource-constrained clients to save some computation when verifying
|
||||
|
@ -690,7 +690,7 @@ def process_sync_committee_updates(state: BeaconState) -> None:
|
|||
next_epoch = get_current_epoch(state) + Epoch(1)
|
||||
if next_epoch % EPOCHS_PER_SYNC_COMMITTEE_PERIOD == 0:
|
||||
state.current_sync_committee = state.next_sync_committee
|
||||
state.next_sync_committee = get_sync_committee(state, next_epoch + EPOCHS_PER_SYNC_COMMITTEE_PERIOD)
|
||||
state.next_sync_committee = get_sync_committee(state, next_epoch)
|
||||
```
|
||||
|
||||
## Initialize state for pure Altair testnets and test vectors
|
||||
|
|
|
@ -80,8 +80,14 @@ def upgrade_to_altair(pre: phase0.BeaconState) -> BeaconState:
|
|||
# Inactivity
|
||||
inactivity_scores=[uint64(0) for _ in range(len(pre.validators))],
|
||||
)
|
||||
|
||||
# Fill in sync committees
|
||||
post.current_sync_committee = get_sync_committee(post, get_current_epoch(post))
|
||||
post.next_sync_committee = get_sync_committee(post, get_current_epoch(post) + EPOCHS_PER_SYNC_COMMITTEE_PERIOD)
|
||||
current_period = epoch // EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||
previous_period = current_period - min(1, current_period)
|
||||
current_base_epoch = current_period * EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||
previous_base_epoch = previous_period * EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||
|
||||
post.current_sync_committee = get_sync_committee(post, previous_base_epoch)
|
||||
post.next_sync_committee = get_sync_committee(post, current_base_epoch)
|
||||
return post
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue