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

Generate seed once for get_beacon_proposer_index #1013

Merged
merged 3 commits into from
May 1, 2019

Conversation

terencechain
Copy link
Contributor

Does it make sense to move generate_seed outside of the while loop so we'd only need to compute once?

Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

agreed seed should be outside loop but you have a bit of a bug in the current refactor.

should be

seed = generate_seed(state, current_epoch)
...
while True:
    ...
    random_byte = hash(seed + int_to_bytes8(i // 32))[i % 32]

@vbuterin
Copy link
Contributor

vbuterin commented May 1, 2019

Reminder that the spec is optimized for readability, not execution speed :)

Though I can see how this could improve readability too.

@djrtwo djrtwo changed the base branch from dev to master May 1, 2019 13:56
@djrtwo djrtwo merged commit a25103c into ethereum:master May 1, 2019
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