Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Pow overflowed error #2

Closed
seequick opened this issue Mar 25, 2023 · 1 comment · Fixed by #4
Closed

Pow overflowed error #2

seequick opened this issue Mar 25, 2023 · 1 comment · Fixed by #4
Assignees
Labels
bug Something isn't working

Comments

@seequick
Copy link

seequick commented Mar 25, 2023

I had this running for about 3 hours

tinyvanityeth -s 000000000 -i 3600

then this occured

Status (24 threads)
  Difficulty:  68719476736
  Generated:   3794821063 addresses
  Speed:       341675 addr/s
  Probability: 5.372%
thread '<unnamed>' panicked at 'Pow overflowed', 
C:\Users\unknown\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\rust_decimal-1.29.0\src\maths.rs:283:21
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

and this

$ tinyvanityeth -s 000000000 -t 8 -i 300
Status (8 threads)
  Difficulty:  68719476736
  Generated:   60583819 addresses
  Speed:       201946 addr/s
  Probability: 0.088%
...
...
Status (8 threads)
  Difficulty:  68719476736
  Generated:   4224656512 addresses
  Speed:       167274 addr/s
  Probability: 5.963%
thread '<unnamed>' panicked at 'Pow overflowed', 
C:\Users\unknown\.cargo\registry\src\github.heygears.com-1ecc6299db9ec823\rust_decimal-1.29.0\src\maths.rs:283:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm using

$ rustc --version
rustc 1.68.1 (8460ca823 2023-03-20)

Specs:

Windows 10 Pro
21H2
19044.2728
AMD Ryzen 9 3900X 12-Core Processor 3.80 GHz

P.S.
seems like
// 1 - (1 - 1 /difficulty)^generated
if generated > u32 it causes Pow overflowed problem

tinyvanityeth/src/main.rs

Lines 204 to 209 in 450f52e

/// Calculates the probability of finding an address by specifying the `difficulty` of finding
/// an address with the given prefix and the total number of addresses `generated` so far.
fn calc_probability(difficulty: u128, generated: u128) -> Decimal {
Decimal::ONE
- (Decimal::ONE - Decimal::ONE / Decimal::from(difficulty)).powd(Decimal::from(generated))
}

@bcsongor
Copy link
Owner

Hey @seequick, thank you for the awesome bug report! 🙌 I was able to reproduce it and will be providing a fix soon.

It seems the panic is indeed a quirk of the rust_decimal library and there's an ongoing discussion on how to address this: paupino/rust-decimal#431

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants