Refactor `validate_attestation`

Co-authored-by: Danny Ryan <dannyjryan@gmail.com>
This commit is contained in:
Hsiao-Wei Wang 2020-06-18 23:20:24 +08:00 committed by GitHub
parent 23cbbb1d08
commit 35bf3b5290
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -765,9 +765,8 @@ def validate_attestation(state: BeaconState, attestation: Attestation) -> None:
# Correct parent block root
assert data.beacon_block_root == get_block_root_at_slot(state, compute_previous_slot(state.slot))
# Correct shard number
assert attestation.data.shard == compute_shard_from_committee_index(
state, attestation.data.index, attestation.data.slot
)
shard = compute_shard_from_committee_index(state, attestation.data.index, attestation.data.slot)
assert attestation.data.shard == shard
# Type 2: no shard transition
else:
# Ensure delayed attestation