This repository has been archived by the owner on Jul 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
Add get_permuted_index
and new swap-or-not shuffle
#363
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hwwhww
changed the title
Add
Add Mar 4, 2019
get_permuted_index
and new swap or not shuffle
get_permuted_index
and new swap-or-not shuffle
NIC619
approved these changes
Mar 7, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
eth2/beacon/_utils/random.py
Outdated
def get_permuted_index(index: int, | ||
list_size: int, | ||
seed: Hash32, | ||
shuffle_round_count: int=90) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious about the reason for a hardcoded default shuffle_round_count
value and does it makes sense to use a constant instead?
eth2/beacon/_utils/random.py
Outdated
h = hash_eth2(seed + round.to_bytes(1, 'little') + (hash_pos // 256).to_bytes(4, 'little')) | ||
byte = h[(hash_pos % 256) // 8] | ||
bit = (byte >> (hash_pos % 8)) % 2 | ||
index = flip if bit else index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not overwrite the input variables.
eth2/beacon/committee_helpers.py
Outdated
@@ -327,6 +333,7 @@ def get_crosslink_committees_at_slot( | |||
slots_per_epoch=slots_per_epoch, | |||
target_committee_size=target_committee_size, | |||
shard_count=shard_count, | |||
shuffle_round_count=shuffle_round_count, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can group these into CommitteeConfig
.
1. Add constants `MAX_EXIT_DEQUEUES_PER_EPOCH` and `SHUFFLE_ROUND_COUNT` 2. Add `get_permuted_index` and new swap or not `shuffle` 3. Use the results of two different approaches to test
Co-Authored-By: hwwhww <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was wrong?
Fix #272
How was it fixed?
MAX_EXIT_DEQUEUES_PER_EPOCH
andSHUFFLE_ROUND_COUNT
get_permuted_index
and new swap or notshuffle
Cute Animal Picture