rename var

This commit is contained in:
Danny Ryan 2018-11-05 13:41:03 +01:00
parent cc910d831a
commit 236ac26867
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 6 additions and 6 deletions

View File

@ -208,7 +208,7 @@ The `CrystallizedState` has the following fields:
'shard_and_committee_for_slots': [[ShardAndCommittee]], 'shard_and_committee_for_slots': [[ShardAndCommittee]],
# Persistent shard committees # Persistent shard committees
'persistent_committees': [['uint24']], 'persistent_committees': [['uint24']],
'persistent_shard_reassignments': [ShardReassignmentRecord], 'persistent_committee_reassignments': [ShardReassignmentRecord],
# Total deposits penalized in the given withdrawal period # Total deposits penalized in the given withdrawal period
'deposits_penalized_in_period': ['uint32'], 'deposits_penalized_in_period': ['uint32'],
# Hash chain of validator set changes (for light clients to easily track deltas) # Hash chain of validator set changes (for light clients to easily track deltas)
@ -820,11 +820,11 @@ def change_validators(validators: List[ValidatorRecord]) -> None:
For any validator that was added or removed from the active validator list during this state recalculation: For any validator that was added or removed from the active validator list during this state recalculation:
* If the validator was removed, remove their index from the `persistent_committees` and remove any `ShardReassignmentRecord`s containing their index from `persistent_shard_reassignments`. * If the validator was removed, remove their index from the `persistent_committees` and remove any `ShardReassignmentRecord`s containing their index from `persistent_committee_reassignments`.
* If the validator was added with index `validator_index`: * If the validator was added with index `validator_index`:
* let `assigned_shard = hash(active_state.randao_mix + bytes8(validator_index)) % SHARD_COUNT` * let `assigned_shard = hash(active_state.randao_mix + bytes8(validator_index)) % SHARD_COUNT`
* let `reassignment_record = ShardReassignmentRecord(validator_index=validator_index, shard=assigned_shard, slot=block.slot + SHARD_PERSISTENT_COMMITTEE_CHANGE_PERIOD)` * let `reassignment_record = ShardReassignmentRecord(validator_index=validator_index, shard=assigned_shard, slot=block.slot + SHARD_PERSISTENT_COMMITTEE_CHANGE_PERIOD)`
* Append `reassignment_record` to the end of `persistent_shard_reassignments` * Append `reassignment_record` to the end of `persistent_committee_reassignments`
Now run the following code to reshuffle a few proposers: Now run the following code to reshuffle a few proposers:
@ -839,10 +839,10 @@ for i in range(num_validators_to_reshuffle):
shard=new_shard, shard=new_shard,
slot=block.slot + SHARD_PERSISTENT_COMMITTEE_CHANGE_PERIOD slot=block.slot + SHARD_PERSISTENT_COMMITTEE_CHANGE_PERIOD
) )
crystallized_state.persistent_shard_reassignments.append(shard_reassignment_record) crystallized_state.persistent_committee_reassignments.append(shard_reassignment_record)
while len(crystallized_state.persistent_shard_reassignments) > 0 and crystallized_state.persistent_shard_reassignments[0].slot <= block.slot: while len(crystallized_state.persistent_committee_reassignments) > 0 and crystallized_state.persistent_committee_reassignments[0].slot <= block.slot:
rec = crystallized_state.persistent_shard_reassignments.pop(0) rec = crystallized_state.persistent_committee_reassignments.pop(0)
for committee in crystallized_state.persistent_committees: for committee in crystallized_state.persistent_committees:
if rec.validator_index in committee: if rec.validator_index in committee:
committee.pop( committee.pop(