check crosslinks validity root against previous
This commit is contained in:
parent
9489ae5dcd
commit
eafcab7e58
|
@ -1920,8 +1920,8 @@ def get_crosslink_deltas(state: BeaconState) -> Tuple[List[Gwei], List[Gwei]]:
|
|||
|
||||
# do not count as success if winning_root did not or cannot form a chain
|
||||
attempted_crosslink = Crosslink(epoch=slot_to_epoch(slot), crosslink_data_root=winning_root, previous_crosslink_root=previous_crosslink_root)
|
||||
current_crosslink_root = hash_tree_root(state.current_crosslinks[shard])
|
||||
if not current_crosslink_root in {previous_crosslink_root, hash_tree_root(attempted_crosslink) }:
|
||||
actual_crosslink_root = hash_tree_root(state.previous_crosslinks[shard])
|
||||
if not actual_crosslink_root in {previous_crosslink_root, hash_tree_root(attempted_crosslink)}:
|
||||
participants = []
|
||||
|
||||
participating_balance = get_total_balance(state, participants)
|
||||
|
|
|
@ -81,10 +81,15 @@ def test_single_crosslink_update_from_previous_epoch(state):
|
|||
assert len(state.previous_epoch_attestations) == 1
|
||||
|
||||
pre_state, post_state = run_process_crosslinks(state)
|
||||
crosslink_deltas = get_crosslink_deltas(state)
|
||||
|
||||
shard = attestation.data.shard
|
||||
assert post_state.previous_crosslinks[shard] != post_state.current_crosslinks[shard]
|
||||
assert pre_state.current_crosslinks[shard] != post_state.current_crosslinks[shard]
|
||||
# ensure rewarded
|
||||
slot = attestation.data.slot
|
||||
assert crosslink_deltas[0][slot % spec.SLOTS_PER_EPOCH] > 0
|
||||
assert crosslink_deltas[1][slot % spec.SLOTS_PER_EPOCH] == 0
|
||||
|
||||
return pre_state, post_state
|
||||
|
||||
|
|
Loading…
Reference in New Issue