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 zero division panic. #4720

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Conversation

Frozen
Copy link
Contributor

@Frozen Frozen commented Jul 23, 2024

Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]: panic: division by zero
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]: goroutine 264 [running]:
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]: math/big.nat.div({0x0?, 0xc00007a800?, 0xc0009d7ce0?}, {0x0?, 0xc00129eaf8?, 0x43e485?}, {0x0?, 0x2507f60?, 0x1?}, {0x0, ...})
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]:         /home/uladzislau/.gvm/gos/go1.21.12/src/math/big/natdiv.go:520 +0x32e
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]: math/big.(*Int).Quo(0xc0009d7ce0, 0xc00129eb30, 0xc000307f60)
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]:         /home/uladzislau/.gvm/gos/go1.21.12/src/math/big/int.go:268 +0x6c
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]: github.com/harmony-one/harmony/numeric.Dec.Quo({0x14?}, {0x0?})
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]:         /home/uladzislau/go/src/github.com/harmony-one/harmony/numeric/decimal.go:303 +0x74
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]: github.com/harmony-one/harmony/consensus/votepower.Compute(0xc001bdcd00, 0xc001bff7c0)
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]:         /home/uladzislau/go/src/github.com/harmony-one/harmony/consensus/votepower/roster.go:204 +0xe25
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]: github.com/harmony-one/harmony/consensus/quorum.newStakeVerifier(0xc001bf8f20?, 0x8853b1d5fcc8e401?)
Jul 23 15:26:07 dco-vals1-go-1-21-testing harmony[1641942]:         /home/uladzislau/go/src/github.com/harmony-one/harmony/consensus/quorum/verifier.go:36 +0x17

Copy link
Contributor

@ONECasey ONECasey left a comment

Choose a reason for hiding this comment

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

Not sure why this isnt passing tests but this looks fine.

@Frozen Frozen force-pushed the fix/avoid-zero-division-panic branch from 8070f87 to 66d32e6 Compare July 24, 2024 23:17
@Frozen Frozen self-assigned this Jul 25, 2024
@sophoah
Copy link
Contributor

sophoah commented Jul 25, 2024

Eventually harmony slot will be 0 in the future

member.OverallPercent = harmonyPercent.Quo(asDecHMYSlotCount)
please fix that as well

@sophoah
Copy link
Contributor

sophoah commented Jul 25, 2024

@ONECasey The rosetta test may fail from time to time a restart of the job may fix the failed build

@ONECasey
Copy link
Contributor

@ONECasey The rosetta test may fail from time to time a restart of the job may fix the failed build

I reset the tests multiple times. Looks like forced rebase worked.

@Frozen
Copy link
Contributor Author

Frozen commented Aug 8, 2024

Eventually harmony slot will be 0 in the future

member.OverallPercent = harmonyPercent.Quo(asDecHMYSlotCount)

please fix that as well

#4727

i'm not sure what default values should be if divider is zero

@sophoah
Copy link
Contributor

sophoah commented Aug 21, 2024

i'm not sure what default values should be if divider is zero

when harmony has 0 slot and 0% vote power it means we are fully decentralized. Harmony assigned slots/keys OverallPercent and GroupPercent should be 0 at that time

See https://api.hmny.io/#659ad999-14ca-4498-8f74-08ed347cab49

@sophoah
Copy link
Contributor

sophoah commented Sep 30, 2024

@Frozen

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.

3 participants