Skip to content

fix: reject NaN/inf rates in commitment parser#208

Open
dripsmvcp wants to merge 1 commit intoentrius:testfrom
dripsmvcp:fix/issue-184-nan-inf-rates
Open

fix: reject NaN/inf rates in commitment parser#208
dripsmvcp wants to merge 1 commit intoentrius:testfrom
dripsmvcp:fix/issue-184-nan-inf-rates

Conversation

@dripsmvcp
Copy link
Copy Markdown

Summary

Closes #184. float('nan') and float('inf') don't raise, and the surrounding except only catches ValueError / IndexError, so neither was rejected by the commitment parser. An inf rate sorted to the top of crown-holder ranking; a NaN rate dropped silently out of comparisons (NaN == NaN is False).

After parsing both rate and counter_rate, reject any value that isn't math.isfinite and > 0.

Test plan

  • Existing commitment parser tests pass
  • Unit test: 'inf' / '-inf' / 'nan' rate strings return None
  • Unit test: 0 and negative rates still rejected
  • Unit test: legitimate finite positive rates still parse

float('nan') and float('inf') do not raise, and the surrounding except
only catches ValueError/IndexError, so neither was rejected. An inf rate
sorted to the top of crown-holder ranking; a NaN rate dropped silently
out of comparisons. Reject any non-finite or non-positive rate.

Closes entrius#184
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.

NaN / inf rates bypass commitment parser

1 participant