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

compute_weak_subjectivity_period should use integer division (//) #2078

Conversation

ericsson49
Copy link
Contributor

@ericsson49 ericsson49 commented Sep 22, 2020

Perhaps because of a typo, compute_weak_subjectivity_period uses non-integer division '/':

weak_subjectivity_period += SAFETY_DECAY * CHURN_LIMIT_QUOTIENT / (2 * 100)

This results in an exception raised:

>>> compute_weak_subjectivity_period(BeaconState())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/c/Users/ericsson/IdeaProjects/eth2.0-specs/tests/core/pyspec/eth2spec/phase1/spec.py", line 2072, in compute_weak_subjectivity_period
    weak_subjectivity_period += SAFETY_DECAY * validator_count / (2 * 100 * MIN_PER_EPOCH_CHURN_LIMIT)
  File "/mnt/c/Users/ericsson/IdeaProjects/eth2.0-specs/venv/lib/python3.8/site-packages/remerkleable/basic.py", line 116, in __truediv__
    raise OperationNotSupported(f"non-integer division '{self} / {other}' "
remerkleable.basic.OperationNotSupported: non-integer division '0 / 800' is not valid for uint64 left hand type

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.

thanks!

@djrtwo djrtwo merged commit d7cb570 into ethereum:dev Sep 22, 2020
@ericsson49 ericsson49 deleted the ericsson49/fix_compute_weak_subjectivity_period branch September 25, 2020 15:27
@ericsson49 ericsson49 restored the ericsson49/fix_compute_weak_subjectivity_period branch October 7, 2020 09:03
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.

2 participants