Refactor `validate_attestation`
Co-authored-by: Danny Ryan <dannyjryan@gmail.com>
This commit is contained in:
parent
23cbbb1d08
commit
35bf3b5290
|
@ -765,9 +765,8 @@ def validate_attestation(state: BeaconState, attestation: Attestation) -> None:
|
||||||
# Correct parent block root
|
# Correct parent block root
|
||||||
assert data.beacon_block_root == get_block_root_at_slot(state, compute_previous_slot(state.slot))
|
assert data.beacon_block_root == get_block_root_at_slot(state, compute_previous_slot(state.slot))
|
||||||
# Correct shard number
|
# Correct shard number
|
||||||
assert attestation.data.shard == compute_shard_from_committee_index(
|
shard = compute_shard_from_committee_index(state, attestation.data.index, attestation.data.slot)
|
||||||
state, attestation.data.index, attestation.data.slot
|
assert attestation.data.shard == shard
|
||||||
)
|
|
||||||
# Type 2: no shard transition
|
# Type 2: no shard transition
|
||||||
else:
|
else:
|
||||||
# Ensure delayed attestation
|
# Ensure delayed attestation
|
||||||
|
|
Loading…
Reference in New Issue