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
AurevoirXavier opened this issue Nov 29, 2019 · 4 comments
Closed

Attempt to Divide by Zero in inflation.rs #129

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

Comments

@AurevoirXavier
Copy link
Member

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

AurevoirXavier commented Nov 29, 2019

@hackfisher, line 26:

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

@AurevoirXavier
Copy link
Member Author

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
@AurevoirXavier
Copy link
Member Author

Fixed: #133.

@AurevoirXavier AurevoirXavier 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