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

Attempt to Divide by Zero in inflation.rs #129

Closed
aurexav opened this issue Nov 29, 2019 · 4 comments
Closed

Attempt to Divide by Zero in inflation.rs #129

aurexav opened this issue Nov 29, 2019 · 4 comments
Assignees

Comments

@aurexav
Copy link
Member

aurexav commented Nov 29, 2019

Thread 'main-tokio-12' panicked at 'attempt to divide by zero', /Users/xavier/Documents/program/darwinia/srml/staking/src/inflation.rs:26
@aurexav
Copy link
Member Author

aurexav commented Nov 29, 2019

@hackfisher, line 26:

let maximum = maximum - maximum * 99_u128.pow(year.integer_sqrt()) / 100_u128.pow(year.integer_sqrt());

@aurexav
Copy link
Member Author

aurexav commented Dec 2, 2019

Is this relate to #103?

Both of them happens at block-height 1000.

When I delete line 26, #103 disappeared.

@hackfisher
Copy link
Contributor

@hackfisher, line 26:

let maximum = maximum - maximum * 99_u128.pow(year.integer_sqrt()) / 100_u128.pow(year.integer_sqrt());

I have no idea, this line related to inflation supply calculation(refer genepaper).

100_u128.pow(year.integer_sqrt()) It looks this value can not be zero, some tests might help

This was referenced Dec 3, 2019
@aurexav
Copy link
Member Author

aurexav commented Dec 3, 2019

Fixed: #133.

@aurexav aurexav closed this as completed Dec 3, 2019
@aurexav aurexav self-assigned this Feb 24, 2020
alfredgit220 pushed a commit to alfredgit220/darwinia that referenced this issue Nov 8, 2021
alfredgit220 pushed a commit to alfredgit220/darwinia that referenced this issue Nov 8, 2021
alfredgit220 pushed a commit to alfredgit220/darwinia that referenced this issue Nov 8, 2021
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

No branches or pull requests

2 participants