Merge pull request #829 from terenc3t/patch-57

Update sync_protocol.md
This commit is contained in:
Hsiao-Wei Wang 2019-03-22 11:52:53 +08:00 committed by GitHub
commit 9e912e03d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -40,8 +40,8 @@ def get_later_start_epoch(slot: Slot) -> int:
return slot - slot % PERSISTENT_COMMITTEE_PERIOD - PERSISTENT_COMMITTEE_PERIOD return slot - slot % PERSISTENT_COMMITTEE_PERIOD - PERSISTENT_COMMITTEE_PERIOD
def get_earlier_period_data(block: ExtendedBeaconBlock, shard_id: Shard) -> PeriodData: def get_earlier_period_data(block: ExtendedBeaconBlock, shard_id: Shard) -> PeriodData:
period_start = get_earlier_start_epoch(header.slot) period_start = get_earlier_start_epoch(block.slot)
validator_count = len(get_active_validator_indices(state, period_start)) validator_count = len(get_active_validator_indices(block.state, period_start))
committee_count = validator_count // (SHARD_COUNT * TARGET_COMMITTEE_SIZE) + 1 committee_count = validator_count // (SHARD_COUNT * TARGET_COMMITTEE_SIZE) + 1
indices = get_shuffled_committee(block.state, shard_id, period_start, 0, committee_count) indices = get_shuffled_committee(block.state, shard_id, period_start, 0, committee_count)
return PeriodData( return PeriodData(
@ -51,8 +51,8 @@ def get_earlier_period_data(block: ExtendedBeaconBlock, shard_id: Shard) -> Peri
) )
def get_later_period_data(block: ExtendedBeaconBlock, shard_id: Shard) -> PeriodData: def get_later_period_data(block: ExtendedBeaconBlock, shard_id: Shard) -> PeriodData:
period_start = get_later_start_epoch(header.slot) period_start = get_later_start_epoch(block.slot)
validator_count = len(get_active_validator_indices(state, period_start)) validator_count = len(get_active_validator_indices(block.state, period_start))
committee_count = validator_count // (SHARD_COUNT * TARGET_COMMITTEE_SIZE) + 1 committee_count = validator_count // (SHARD_COUNT * TARGET_COMMITTEE_SIZE) + 1
indices = get_shuffled_committee(block.state, shard_id, period_start, 0, committee_count) indices = get_shuffled_committee(block.state, shard_id, period_start, 0, committee_count)
return PeriodData( return PeriodData(