From c239ce0b5eb1b350c80fde7617ecc194a26dbad1 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Thu, 17 Oct 2019 10:45:07 +0900 Subject: [PATCH] crosslink committee -> beacon committee --- specs/core/0_beacon-chain.md | 10 +++++----- specs/core/1_custody-game.md | 2 +- specs/core/1_shard-data-chains.md | 1 + specs/validator/0_beacon-chain-validator.md | 4 ++-- test_libs/pyspec/eth2spec/test/helpers/attestations.py | 8 ++++---- test_libs/pyspec/eth2spec/test/helpers/custody.py | 6 +++--- .../test_process_justification_and_finalization.py | 2 +- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 19712a7d9..bf941eabd 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -81,7 +81,7 @@ - [`get_active_validator_indices`](#get_active_validator_indices) - [`get_validator_churn_limit`](#get_validator_churn_limit) - [`get_seed`](#get_seed) - - [`get_crosslink_committee`](#get_crosslink_committee) + - [`get_beacon_committee`](#get_beacon_committee) - [`get_beacon_proposer_index`](#get_beacon_proposer_index) - [`get_total_balance`](#get_total_balance) - [`get_total_active_balance`](#get_total_active_balance) @@ -872,10 +872,10 @@ def get_committees_per_slot(state: BeaconState, slot: Slot) -> uint64: )) ``` -#### `get_crosslink_committee` +#### `get_beacon_committee` ```python -def get_crosslink_committee(state: BeaconState, slot: Slot, index: CommitteeIndex) -> Sequence[ValidatorIndex]: +def get_beacon_committee(state: BeaconState, slot: Slot, index: CommitteeIndex) -> Sequence[ValidatorIndex]: """ Return the crosslink committee at ``slot`` for ``index``. """ @@ -965,7 +965,7 @@ def get_attesting_indices(state: BeaconState, """ Return the set of attesting indices corresponding to ``data`` and ``bits``. """ - committee = get_crosslink_committee(state, data.slot, data.index) + committee = get_beacon_committee(state, data.slot, data.index) return set(index for i, index in enumerate(committee) if bits[i]) ``` @@ -1504,7 +1504,7 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None: assert data.target.epoch in (get_previous_epoch(state), get_current_epoch(state)) assert data.slot + MIN_ATTESTATION_INCLUSION_DELAY <= state.slot <= data.slot + SLOTS_PER_EPOCH - committee = get_crosslink_committee(state, data.slot, data.index) + committee = get_beacon_committee(state, data.slot, data.index) assert len(attestation.aggregation_bits) == len(attestation.custody_bits) == len(committee) pending_attestation = PendingAttestation( diff --git a/specs/core/1_custody-game.md b/specs/core/1_custody-game.md index 2fc4904ce..80a42cc14 100644 --- a/specs/core/1_custody-game.md +++ b/specs/core/1_custody-game.md @@ -624,7 +624,7 @@ def process_bit_challenge(state: BeaconState, challenge: CustodyBitChallenge) -> chunk_count = get_custody_chunk_count(attestation.data.crosslink) assert chunk_count == len(challenge.chunk_bits) # Verify custody bit is incorrect - committee = get_crosslink_committee(state, epoch, shard) + committee = get_beacon_committee(state, epoch, shard) custody_bit = attestation.custody_bits[committee.index(challenge.responder_index)] assert custody_bit != get_chunk_bits_root(challenge.chunk_bits) # Add new bit challenge record diff --git a/specs/core/1_shard-data-chains.md b/specs/core/1_shard-data-chains.md index 9bd9c70ee..477dce44f 100644 --- a/specs/core/1_shard-data-chains.md +++ b/specs/core/1_shard-data-chains.md @@ -62,6 +62,7 @@ This document describes the shard transition function (data layer only) and the | Name | Value | | - | - | +| `SHARD_COUNT` | `2**10` (= 1,024) | | `MIN_BLOCK_BODY_PRICE` | `2**0` (= 1) | | `MAX_PERIOD_COMMITTEE_SIZE` | `2**7` (= 128) | | `SHARD_HEADER_SIZE` | `2**10` (= 1024) | diff --git a/specs/validator/0_beacon-chain-validator.md b/specs/validator/0_beacon-chain-validator.md index 15edc1e28..454b99a41 100644 --- a/specs/validator/0_beacon-chain-validator.md +++ b/specs/validator/0_beacon-chain-validator.md @@ -150,7 +150,7 @@ def get_committee_assignment(state: BeaconState, start_slot = compute_start_slot_of_epoch(epoch) for slot in range(start_slot, start_slot + SLOTS_PER_EPOCH): for index in range(get_committees_per_slot(state, Slot(slot))): - committee = get_crosslink_committee(state, Slot(slot), CommitteeIndex(index)) + committee = get_beacon_committee(state, Slot(slot), CommitteeIndex(index)) if validator_index in committee: return committee, CommitteeIndex(index), Slot(slot) return None @@ -166,7 +166,7 @@ def is_proposer(state: BeaconState, *Note*: To see if a validator is assigned to propose during the slot, the beacon state must be in the epoch in question. At the epoch boundaries, the validator must run an epoch transition into the epoch to successfully check the proposal assignment of the first slot. -*Note*: `BeaconBlock` proposal is distinct from crosslink committee assignment, and in a given epoch each responsibility might occur at different a different slot. +*Note*: `BeaconBlock` proposal is distinct from beacon committee assignment, and in a given epoch each responsibility might occur at different a different slot. ### Lookahead diff --git a/test_libs/pyspec/eth2spec/test/helpers/attestations.py b/test_libs/pyspec/eth2spec/test/helpers/attestations.py index afd51b0bd..e4540738a 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/attestations.py +++ b/test_libs/pyspec/eth2spec/test/helpers/attestations.py @@ -46,13 +46,13 @@ def get_valid_attestation(spec, state, slot=None, index=None, signed=False): attestation_data = build_attestation_data(spec, state, slot, index) - crosslink_committee = spec.get_crosslink_committee( + beacon_committee = spec.get_beacon_committee( state, attestation_data.slot, attestation_data.index, ) - committee_size = len(crosslink_committee) + committee_size = len(beacon_committee) aggregation_bits = Bitlist[spec.MAX_VALIDATORS_PER_COMMITTEE](*([0] * committee_size)) custody_bits = Bitlist[spec.MAX_VALIDATORS_PER_COMMITTEE](*([0] * committee_size)) attestation = spec.Attestation( @@ -115,12 +115,12 @@ def get_attestation_signature(spec, state, attestation_data, privkey, custody_bi def fill_aggregate_attestation(spec, state, attestation): - crosslink_committee = spec.get_crosslink_committee( + beacon_committee = spec.get_beacon_committee( state, attestation.data.slot, attestation.data.index, ) - for i in range(len(crosslink_committee)): + for i in range(len(beacon_committee)): attestation.aggregation_bits[i] = True diff --git a/test_libs/pyspec/eth2spec/test/helpers/custody.py b/test_libs/pyspec/eth2spec/test/helpers/custody.py index 98659ee8e..205a335f4 100644 --- a/test_libs/pyspec/eth2spec/test/helpers/custody.py +++ b/test_libs/pyspec/eth2spec/test/helpers/custody.py @@ -80,13 +80,13 @@ def bitlist_from_int(max_len, num_bits, n): def get_valid_bit_challenge(spec, state, attestation, invalid_custody_bit=False): - crosslink_committee = spec.get_crosslink_committee( + beacon_committee = spec.get_beacon_committee( state, attestation.data.slot, attestation.data.crosslink.shard, ) - responder_index = crosslink_committee[0] - challenger_index = crosslink_committee[-1] + responder_index = beacon_committee[0] + challenger_index = beacon_committee[-1] epoch = spec.get_randao_epoch_for_custody_period(attestation.data.target.epoch, responder_index) diff --git a/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_justification_and_finalization.py b/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_justification_and_finalization.py index 8fc3f9866..88470eb93 100644 --- a/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_justification_and_finalization.py +++ b/test_libs/pyspec/eth2spec/test/phase_0/epoch_processing/test_process_justification_and_finalization.py @@ -34,7 +34,7 @@ def add_mock_attestations(spec, state, epoch, source, target, sufficient_support if remaining_balance < 0: return - committee = spec.get_crosslink_committee(state, slot, index) + committee = spec.get_beacon_committee(state, slot, index) # Create a bitfield filled with the given count per attestation, # exactly on the right-most part of the committee field.