Merge pull request #1843 from terencechain/patch-99

Use `compute_previous_slot` for `slot - 1` occurrences
This commit is contained in:
Danny Ryan 2020-05-26 10:02:14 -06:00 committed by GitHub
commit 753a25e5db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -801,7 +801,7 @@ def apply_shard_transition(state: BeaconState, shard: Shard, transition: ShardTr
# Save updated state # Save updated state
state.shard_states[shard] = transition.shard_states[len(transition.shard_states) - 1] state.shard_states[shard] = transition.shard_states[len(transition.shard_states) - 1]
state.shard_states[shard].slot = state.slot - 1 state.shard_states[shard].slot = compute_previous_slot(state.slot)
``` ```
###### `process_crosslink_for_shard` ###### `process_crosslink_for_shard`
@ -953,7 +953,7 @@ def process_attester_slashing(state: BeaconState, attester_slashing: AttesterSla
def verify_shard_transition_false_positives(state: BeaconState, block_body: BeaconBlockBody) -> None: def verify_shard_transition_false_positives(state: BeaconState, block_body: BeaconBlockBody) -> None:
# Verify that a `shard_transition` in a block is empty if an attestation was not processed for it # Verify that a `shard_transition` in a block is empty if an attestation was not processed for it
for shard in range(get_active_shard_count(state)): for shard in range(get_active_shard_count(state)):
if state.shard_states[shard].slot != state.slot - 1: if state.shard_states[shard].slot != compute_previous_slot(state.slot):
assert block_body.shard_transitions[shard] == ShardTransition() assert block_body.shard_transitions[shard] == ShardTransition()
``` ```