mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-26 01:05:15 +00:00
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
|
```python
|
||||||
def get_sync_committee(state: BeaconState, epoch: Epoch) -> SyncCommittee:
|
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
|
``SyncCommittee`` contains an aggregate pubkey that enables
|
||||||
resource-constrained clients to save some computation when verifying
|
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)
|
next_epoch = get_current_epoch(state) + Epoch(1)
|
||||||
if next_epoch % EPOCHS_PER_SYNC_COMMITTEE_PERIOD == 0:
|
if next_epoch % EPOCHS_PER_SYNC_COMMITTEE_PERIOD == 0:
|
||||||
state.current_sync_committee = state.next_sync_committee
|
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
|
## Initialize state for pure Altair testnets and test vectors
|
||||||
|
@ -80,8 +80,14 @@ def upgrade_to_altair(pre: phase0.BeaconState) -> BeaconState:
|
|||||||
# Inactivity
|
# Inactivity
|
||||||
inactivity_scores=[uint64(0) for _ in range(len(pre.validators))],
|
inactivity_scores=[uint64(0) for _ in range(len(pre.validators))],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Fill in sync committees
|
# Fill in sync committees
|
||||||
post.current_sync_committee = get_sync_committee(post, get_current_epoch(post))
|
current_period = epoch // EPOCHS_PER_SYNC_COMMITTEE_PERIOD
|
||||||
post.next_sync_committee = get_sync_committee(post, get_current_epoch(post) + 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
|
return post
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user