switch all but 4 remaining callers to get_crosslink_committee(...) to get_beacon_committee(...)

This commit is contained in:
Dustin Brody 2019-11-11 12:43:00 +01:00
parent 568fa1dcb9
commit d457dfee81
5 changed files with 21 additions and 24 deletions

View File

@ -64,8 +64,7 @@ func get_committee_count_at_slot*(state: BeaconState, slot: Slot): uint64 =
1, MAX_COMMITTEES_PER_SLOT).uint64
result = committees_per_slot
# Otherwise, get_crosslink_committee_at_slot(...) cannot access some
# committees.
# Otherwise, get_beacon_committee(...) cannot access some committees.
doAssert (SLOTS_PER_EPOCH * MAX_COMMITTEES_PER_SLOT).uint64 >= result
# https://github.com/ethereum/eth2.0-specs/blob/v0.9.1/specs/core/0_beacon-chain.md#get_current_epoch

View File

@ -424,7 +424,7 @@ proc process_epoch*(state: var BeaconState) =
# Don't rely on caching here.
process_registry_updates(state)
## Caching here for get_crosslink_committee(...) can break otherwise, since
## Caching here for get_beacon_committee(...) can break otherwise, since
## get_active_validator_indices(...) usually changes.
# TODO is this cache still necessary/useful? presumably not, but can't remove
# quite yet

View File

@ -113,8 +113,6 @@ func get_start_shard*(state: BeaconState, epoch: Epoch): Shard =
# TODO remove when shim layer isn't needed
func get_slot_and_index*(state: BeaconState, epoch: Epoch, shard: Shard): auto =
# This is simply the index get_crosslink_committee(...) computes for
# compute_committee(...)
let gcc_index =
(shard + SHARD_COUNT - get_start_shard(state, epoch)) mod SHARD_COUNT

View File

@ -40,10 +40,10 @@ suite "Attestation pool processing" & preset():
withPool:
let
# Create an attestation for slot 1!
crosslink_committee = get_crosslink_committee(state.data.data,
compute_epoch_at_slot(state.data.data.slot), 1, cache)
beacon_committee = get_beacon_committee(state.data.data,
state.data.data.slot, 0, cache)
attestation = makeAttestation(
state.data.data, state.blck.root, crosslink_committee[0])
state.data.data, state.blck.root, beacon_committee[0])
pool.add(state.data.data, state.blck, attestation)
@ -60,10 +60,10 @@ suite "Attestation pool processing" & preset():
withPool:
let
# Create an attestation for slot 1!
cc0 = get_crosslink_committee(state.data.data,
compute_epoch_at_slot(state.data.data.slot), 1, cache)
bc0 = get_beacon_committee(state.data.data,
state.data.data.slot, 0, cache)
attestation0 = makeAttestation(
state.data.data, state.blck.root, cc0[0])
state.data.data, state.blck.root, bc0[0])
process_slots(state.data, state.data.data.slot + 1)
@ -90,12 +90,12 @@ suite "Attestation pool processing" & preset():
withPool:
let
# Create an attestation for slot 1!
cc0 = get_crosslink_committee(state.data.data,
compute_epoch_at_slot(state.data.data.slot), 1, cache)
bc0 = get_beacon_committee(state.data.data,
state.data.data.slot, 0, cache)
attestation0 = makeAttestation(
state.data.data, state.blck.root, cc0[0])
state.data.data, state.blck.root, bc0[0])
attestation1 = makeAttestation(
state.data.data, state.blck.root, cc0[1])
state.data.data, state.blck.root, bc0[1])
pool.add(state.data.data, state.blck, attestation0)
pool.add(state.data.data, state.blck, attestation1)
@ -114,12 +114,12 @@ suite "Attestation pool processing" & preset():
var
# Create an attestation for slot 1!
cc0 = get_crosslink_committee(state.data.data,
compute_epoch_at_slot(state.data.data.slot), 1, cache)
bc0 = get_beacon_committee(state.data.data,
state.data.data.slot, 0, cache)
attestation0 = makeAttestation(
state.data.data, state.blck.root, cc0[0])
state.data.data, state.blck.root, bc0[0])
attestation1 = makeAttestation(
state.data.data, state.blck.root, cc0[1])
state.data.data, state.blck.root, bc0[1])
attestation0.combine(attestation1, {skipValidation})
@ -139,12 +139,12 @@ suite "Attestation pool processing" & preset():
withPool:
var
# Create an attestation for slot 1!
cc0 = get_crosslink_committee(state.data.data,
compute_epoch_at_slot(state.data.data.slot), 1, cache)
bc0 = get_beacon_committee(state.data.data,
state.data.data.slot, 0, cache)
attestation0 = makeAttestation(
state.data.data, state.blck.root, cc0[0])
state.data.data, state.blck.root, bc0[0])
attestation1 = makeAttestation(
state.data.data, state.blck.root, cc0[1])
state.data.data, state.blck.root, bc0[1])
attestation0.combine(attestation1, {skipValidation})

View File

@ -84,7 +84,7 @@ suite "Block processing" & preset():
let
# Create an attestation for slot 1 signed by the only attester we have!
crosslink_committee =
get_crosslink_committee(state, compute_epoch_at_slot(state.slot), 0, cache)
get_beacon_committee(state, state.slot, 0, cache)
attestation = makeAttestation(
state, previous_block_root, crosslink_committee[0])