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

panic: division by zero error #199

Closed
FidelVe opened this issue Jan 23, 2024 · 0 comments · Fixed by #200
Closed

panic: division by zero error #199

FidelVe opened this issue Jan 23, 2024 · 0 comments · Fixed by #200
Assignees

Comments

@FidelVe
Copy link

FidelVe commented Jan 23, 2024

Good day team!

Im running a local multi node chain, after cloning the goloop locally im building the image with the make gochain-icon-image (the image being build is v1.4.0-rc.1)

after that I run the multi node docker setup with docker compose, the nodes run succesfully but after a couple minutes they simply crash.

the logs of the nodes have the following info at the end

I|20240123-05:06:32.505286|e9df|8cb6dd|SV|iiss4.go:38 Global Option: GlobalV3{revision=25 iissVersion=4 startHeight=1 offsetLimit=299 electedPRepCount=0 bondRequirement=0 rFund=RewardFund{version=0 Iglobal=15552000000 Icps=0 Iprep=5000 Irelay=0 Ivoter=5000} minBond=0}
D|20240123-05:06:32.505346|e9df|8cb6dd|SV|iiss4.go:131 get event at 245 EventEnable{target=hxb6b5791be0b5ef67063b3c10b840fb81514db2fd status=Enable}
D|20240123-05:06:32.505365|e9df|8cb6dd|SV|prep.go:280 SetStatus: hxb6b5791be0b5ef67063b3c10b840fb81514db2fd to 0
D|20240123-05:06:32.505393|e9df|8cb6dd|SV|prep.go:350 CalculateReward()
D|20240123-05:06:32.505409|e9df|8cb6dd|SV|prep.go:353 RewardFund: PRep: 1800000000, wage: 0
panic: division by zero

goroutine 2529 [running]:
math/big.nat.div({0x0?, 0xb05f4f?, 0xc0005002a0?}, {0x0?, 0xc000ba1920?, 0x25?}, {0x0?, 0x913c6a?, 0xc002df2640?}, {0x0, ...})
        /usr/local/go/src/math/big/natdiv.go:520 +0x34b
math/big.(*Int).QuoRem(0xc002df2640, 0xc002df25e0, 0xc000b13dd8, 0xc000b13d18)
        /usr/local/go/src/math/big/int.go:286 +0x9c
math/big.(*Int).Div(0xd449df?, 0x16bbee7?, 0xc002df25a0?)
        /usr/local/go/src/math/big/int.go:297 +0x45
github.com/icon-project/goloop/icon/iiss/calculator.(*PRepInfo).CalculateReward(0xc002776140, 0x169c922?, 0x18dcbf0?, 0x18dcbf0?)
        /work/icon/iiss/calculator/prep.go:354 +0x1d6
github.com/icon-project/goloop/icon/iiss/calculator.(*iiss4Reward).processPrepReward(0xc0068ce750)
        /work/icon/iiss/calculator/iiss4.go:166 +0xae
github.com/icon-project/goloop/icon/iiss/calculator.(*iiss4Reward).Calculate(0xc0068ce750)
        /work/icon/iiss/calculator/iiss4.go:53 +0x1a6
github.com/icon-project/goloop/icon/iiss/calculator.(*calculator).run(0xc005142510)
        /work/icon/iiss/calculator/calculator.go:184 +0x1ab
created by github.com/icon-project/goloop/icon/iiss/calculator.New
        /work/icon/iiss/calculator/calculator.go:332 +0x24d

Im guessing that this might be because I havent registered any preps at this point so there is no prep to give rewards after a term so im going to try running the containers and then quickly registering preps

@eunsoo-icon eunsoo-icon self-assigned this Jan 23, 2024
eunsoo-icon added a commit that referenced this issue Jan 23, 2024
- skip reward calculation if there are no eletected PReps
@eunsoo-icon eunsoo-icon linked a pull request Jan 23, 2024 that will close this issue
eunsoo-icon added a commit that referenced this issue Jan 24, 2024
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 a pull request may close this issue.

2 participants