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

Fix error in refund calculation #727

Merged
merged 4 commits into from
Aug 13, 2019

Conversation

mgudemann
Copy link
Contributor

This fixes an error in the refund calculation, effectively it used (d + (1 - d)) *exp(x) instead of (d + (1 - d)*exp(x)). Also the fpEpsilon constant was wrong, making all decay instantaneous.

This also adds examples for different ways to use

  • no decay
  • instant decay
  • full refund (minimal refund 100%)

- value of `fpEpsilon` was off by the precision factor of `FixedPoint`
- formula for refund calculation with decay was parenthesized in a wrong way
@mgudemann mgudemann requested a review from JaredCorduan as a code owner August 7, 2019 18:19
change `REWARD` to `RUPD`, update references
@@ -35,7 +35,7 @@ fpPrecision :: FixedPoint
fpPrecision = (10::FixedPoint)^(34::Integer)

fpEpsilon :: FixedPoint
fpEpsilon = (10::FixedPoint)^(17::Integer)
fpEpsilon = (10::FixedPoint)^(17::Integer) / fpPrecision
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ha, yes!

Copy link
Contributor

@JaredCorduan JaredCorduan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @mgudemann! thank you for fixing up the reward calculation and also adding some examples! 🚜

@JaredCorduan JaredCorduan merged commit 11421e1 into master Aug 13, 2019
@JaredCorduan JaredCorduan deleted the shelley/exec_spec/refund_calculation branch August 13, 2019 11:19
kevinhammond pushed a commit that referenced this pull request Oct 28, 2019
…_calculation

Fix error in refund calculation
nc6 pushed a commit that referenced this pull request May 19, 2020
755: Document the address discrimination problem from cardano-sl (NetworkMagic) r=intricate a=intricate

Closes #727.

Co-authored-by: Luke Nadur <[email protected]>
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.

2 participants