Add notes

This commit is contained in:
Hsiao-Wei Wang 2020-07-17 00:18:44 +08:00
parent 8fb96f1860
commit 0b81c967fa
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
3 changed files with 4 additions and 1 deletions

View File

@ -772,6 +772,7 @@ def validate_attestation(state: BeaconState, attestation: Attestation) -> None:
# Correct shard number
shard = compute_shard_from_committee_index(state, data.index, data.slot)
assert data.shard == shard
# NOTE: We currently set `PHASE_1_FORK_SLOT` to `GENESIS_SLOT` for test vectors.
if data.slot == PHASE_1_FORK_SLOT:
assert data.shard_transition_root == hash_tree_root(ShardTransition())
else:
@ -979,6 +980,7 @@ def verify_empty_shard_transition(state: BeaconState, shard_transitions: Sequenc
def process_shard_transitions(state: BeaconState,
shard_transitions: Sequence[ShardTransition],
attestations: Sequence[Attestation]) -> None:
# NOTE: We currently set `PHASE_1_FORK_SLOT` to `GENESIS_SLOT` for test vectors.
if compute_previous_slot(state.slot) != PHASE_1_FORK_SLOT:
# Process crosslinks
process_crosslinks(state, shard_transitions, attestations)

View File

@ -310,6 +310,7 @@ def get_shard_transition_fields(
def get_shard_transition(beacon_state: BeaconState,
shard: Shard,
shard_blocks: Sequence[SignedShardBlock]) -> ShardTransition:
# NOTE: We currently set `PHASE_1_FORK_SLOT` to `GENESIS_SLOT` for test vectors.
if beacon_state.slot == PHASE_1_FORK_SLOT:
return ShardTransition()

View File

@ -88,7 +88,7 @@ def build_attestation_data(spec, state, slot, index, shard=None, shard_transitio
data.shard_transition_root = shard_transition.hash_tree_root()
else:
if on_time:
if data.slot == spec.PHASE_1_FORK_SLOT:
if data.slot == spec.GENESIS_SLOT:
data.shard_head_root = spec.Root()
data.shard_transition_root = spec.ShardTransition().hash_tree_root()
else: