Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Break up crosslink_committees_at_slot #707

Closed
wants to merge 6 commits into from
Closed

Conversation

djrtwo
Copy link
Contributor

@djrtwo djrtwo commented Mar 1, 2019

Attempt to "simplify" get_crosslink_committees_at_slot.
Broke it up into (maybe) more manageable functions. Not really convinced this helps much but throwing it up here while I think more

cc: @JustinDrake, @terenc3t

Copy link
Contributor

@terencechain terencechain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me happy. Thanks Danny!

slot: Slot,
start_shard: Shard,
committees_per_epoch: int) -> List[Tuple[List[ValidatorIndex], Shard]]:
offset = slot % SLOTS_PER_EPOCH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add an assert to check shuffling_epoch out of bound condition?

assert get_previous_epoch(state) <= shuffling_epoch <= get_current_epoch(state)+1

epochs_since_last_registry_update = current_epoch - state.validator_registry_update_epoch
if registry_change:
committees_per_epoch = get_next_epoch_committee_count(state)
seed = generate_seed(state, next_epoch)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to define next_epoch

seed,
shuffling_epoch,
slot,
start_shard,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
start_shard,
shuffling_start_shard,

Copy link
Contributor

@hwwhww hwwhww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! 👍 Will take another look when it's ready for review.

def get_crosslink_committees(state: BeaconState,
seed: Bytes32,
shuffling_epoch: Epoch,
slot: Slot,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: move slot next to state to align with the order of the caller functions.

def get_crosslink_committees(state: BeaconState,
                             slot: Slot,
                             seed: Bytes32,
                             ...

)
for i in range(committees_per_slot)
]
return get_next_epoch_committee_count(state, slot, registry_change)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return get_next_epoch_committee_count(state, slot, registry_change)
return get_next_epoch_committees_at_slot(state, slot, registry_change)

@terencechain
Copy link
Contributor

Implemented here: prysmaticlabs/prysm#1771

@JustinDrake
Copy link
Collaborator

Closing in favour of #808 🔥

@djrtwo djrtwo deleted the break-up-function branch May 20, 2020 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants