Merge branch 'dev' into executable_fork_choice
* dev: Fix #1173 attestations: check shard, and check epoch earlier
This commit is contained in:
commit
20d8156f46
|
@ -991,6 +991,7 @@ def convert_to_indexed(state: BeaconState, attestation: Attestation) -> IndexedA
|
||||||
"""
|
"""
|
||||||
attesting_indices = get_attesting_indices(state, attestation.data, attestation.aggregation_bitfield)
|
attesting_indices = get_attesting_indices(state, attestation.data, attestation.aggregation_bitfield)
|
||||||
custody_bit_1_indices = get_attesting_indices(state, attestation.data, attestation.custody_bitfield)
|
custody_bit_1_indices = get_attesting_indices(state, attestation.data, attestation.custody_bitfield)
|
||||||
|
assert set(custody_bit_1_indices).issubset(attesting_indices)
|
||||||
custody_bit_0_indices = [index for index in attesting_indices if index not in custody_bit_1_indices]
|
custody_bit_0_indices = [index for index in attesting_indices if index not in custody_bit_1_indices]
|
||||||
|
|
||||||
return IndexedAttestation(
|
return IndexedAttestation(
|
||||||
|
@ -1722,6 +1723,10 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None:
|
||||||
Process ``Attestation`` operation.
|
Process ``Attestation`` operation.
|
||||||
"""
|
"""
|
||||||
data = attestation.data
|
data = attestation.data
|
||||||
|
|
||||||
|
assert data.crosslink.shard < SHARD_COUNT
|
||||||
|
assert data.target_epoch in (get_previous_epoch(state), get_current_epoch(state))
|
||||||
|
|
||||||
attestation_slot = get_attestation_data_slot(state, data)
|
attestation_slot = get_attestation_data_slot(state, data)
|
||||||
assert attestation_slot + MIN_ATTESTATION_INCLUSION_DELAY <= state.slot <= attestation_slot + SLOTS_PER_EPOCH
|
assert attestation_slot + MIN_ATTESTATION_INCLUSION_DELAY <= state.slot <= attestation_slot + SLOTS_PER_EPOCH
|
||||||
|
|
||||||
|
@ -1732,7 +1737,6 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None:
|
||||||
proposer_index=get_beacon_proposer_index(state),
|
proposer_index=get_beacon_proposer_index(state),
|
||||||
)
|
)
|
||||||
|
|
||||||
assert data.target_epoch in (get_previous_epoch(state), get_current_epoch(state))
|
|
||||||
if data.target_epoch == get_current_epoch(state):
|
if data.target_epoch == get_current_epoch(state):
|
||||||
ffg_data = (state.current_justified_epoch, state.current_justified_root, get_current_epoch(state))
|
ffg_data = (state.current_justified_epoch, state.current_justified_root, get_current_epoch(state))
|
||||||
parent_crosslink = state.current_crosslinks[data.crosslink.shard]
|
parent_crosslink = state.current_crosslinks[data.crosslink.shard]
|
||||||
|
|
Loading…
Reference in New Issue