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

fixed panic: runtime error: integer divide by zero #4777 #4823

Merged
merged 12 commits into from Feb 16, 2020

Conversation

aranhaagency
Copy link
Contributor

add Simple checker for integer divide

[Part of|Resolves] #4777


@claassistantio
Copy link

claassistantio commented Feb 10, 2020

CLA assistant check
All committers have signed the CLA.

@rauljordan
Copy link
Contributor

Hi @aranhaagency sorry for the misunderstanding, but the problem isn't that we're overflowing the max value of an int - the problem is we're accessing an element out of range in the list. Here's the issue:

list = [a, b, c, d, e]

I want to access element 24:

item := list[24]
panic: index 24 out of range in list of length 5

That's the issue we're trying to solve. What you can do is generate a random number again in a for loop until you generate one that is < the length of the list. It shouldn't take many retries to get a number that doesn't go out of range.

@aranhaagency
Copy link
Contributor Author

Hi @rauljordan, Thanks.
for the feedback I will implement.

@terencechain terencechain added the Ready For Review A pull request ready for code review label Feb 16, 2020
@codecov
Copy link

codecov bot commented Feb 16, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@b3a3d02). Click here to learn what that means.
The diff coverage is 61.7%.

@@            Coverage Diff            @@
##             master    #4823   +/-   ##
=========================================
  Coverage          ?   57.46%           
=========================================
  Files             ?      255           
  Lines             ?    19264           
  Branches          ?        0           
=========================================
  Hits              ?    11071           
  Misses            ?     6677           
  Partials          ?     1516

@terencechain
Copy link
Member

@aranhaagency handled it since this issue is more pressuring to current testnet. Thanks for starting!

@terencechain terencechain merged commit 8885d71 into prysmaticlabs:master Feb 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants