-
Notifications
You must be signed in to change notification settings - Fork 40
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
fix: overflow bug in payout curve #162
fix: overflow bug in payout curve #162
Conversation
Fix commit: p2pderivatives/rust-dlc@f233718 PR into latest: p2pderivatives/rust-dlc#162 Signed-off-by: Philipp Hoenisch <philipp@coblox.tech>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, surprised that it was not caught before.
dlc-manager/src/payout_curve.rs
Outdated
let slope = (right_point.outcome_payout - left_point.outcome_payout) as f64 | ||
/ (right_point.event_outcome - left_point.event_outcome) as f64; | ||
let slope = (right_point.outcome_payout as f64 - left_point.outcome_payout as f64) | ||
/ (right_point.event_outcome as f64 - left_point.event_outcome as f64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: as we expect event outcomes to be increasing only you don't really need to change this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. I've removed these changes.
It is possible that a payout curve decreases with the amount of payout as the events increase. This lead to an overflow panic in the evaluate function Signed-off-by: Philipp Hoenisch <philipp@coblox.tech>
f233718
to
e42cfcf
Compare
Fix commit: p2pderivatives/rust-dlc@f233718 PR into latest: p2pderivatives/rust-dlc#162 Signed-off-by: Philipp Hoenisch <philipp@coblox.tech>
Fix commit: p2pderivatives/rust-dlc@f233718 PR into latest: p2pderivatives/rust-dlc#162 Signed-off-by: Philipp Hoenisch <philipp@coblox.tech>
It is possible that a payout curve decreases with the amount of payout as the events increase. This lead to an overflow panic in the evaluate function