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

[BUG] - pool margin value not shown correctly in ledger-state #1063

Closed
bergr01 opened this issue May 25, 2020 · 2 comments · Fixed by #1110
Closed

[BUG] - pool margin value not shown correctly in ledger-state #1063

bergr01 opened this issue May 25, 2020 · 2 comments · Fixed by #1110
Assignees
Labels
bug Something isn't working Pioneer Issues related to the Pioneer F&F Testnet priority high issues/PRs that MUST be addressed. The release can't happen without this;

Comments

@bergr01
Copy link

bergr01 commented May 25, 2020

cardano-cli / cardano-node version 1.12.0 on master.

Registered a new stake pool on FnF network - specified non-zero margin (e.g. 0.75) when creating stake pool registration certificate. Followed the rest of the steps, submitted the transaction - pool record was created in ledger-state output (seen via cardano-cli shelley query ledger-state --testnet-magic 42 command).

Expected to see poolMargin field with the same value as was specified during pool creation - instead, poolMargin is listed as 0 for all stake pools.

@bergr01 bergr01 added Pioneer Issues related to the Pioneer F&F Testnet bug Something isn't working labels May 25, 2020
@kevinhammond kevinhammond added the priority high issues/PRs that MUST be addressed. The release can't happen without this; label May 28, 2020
@onyxstakepool
Copy link
Contributor

@dcoutts The precision epsilon of the rational approximation was set to 1 in the parser.
Thus for most x in [0, 1] the best rational approximation of x in the interval [x - 1, x + 1] is 0/1.

This is fixed by setting epsilon equal to 0 and thus enforcing a machine precision rational approximation.

diff --git a/cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs b/cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs
index 2caff9dd..fd4302a7 100644
--- a/cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs
+++ b/cardano-cli/src/Cardano/CLI/Shelley/Parsers.hs
@@ -1112,7 +1112,7 @@ pPoolCost =
 
 pPoolMargin :: Parser ShelleyStakePoolMargin
 pPoolMargin =
-  (\dbl -> maybeOrFail . Shelley.mkUnitInterval $ approxRational (dbl :: Double) 1) <$>
+  (\dbl -> maybeOrFail . Shelley.mkUnitInterval $ approxRational (dbl :: Double) 0) <$>
     Opt.option Opt.auto
       (  Opt.long "pool-margin"
       <> Opt.metavar "DOUBLE"

@onyxstakepool
Copy link
Contributor

@dcoutts I have tested the fix with the pool margin set to the irrational Euler constant gamma = 0.57721 56649 01532 86060... The parsed pool margin approximates the Euler constant up to 15 digits as expected for double precision numbers.

onyxstakepool added a commit to onyxstakepool/cardano-node that referenced this issue Jun 1, 2020
Closes: IntersectMBO#1063

@dcoutts The precision epsilon of the rational approximation was set to 1 in the parser.
Thus for most x in [0, 1] the best rational approximation of x in the interval [x - 1, x + 1] is 0/1.

This is fixed by setting epsilon equal to 0 and thus enforcing a machine precision rational approximation.
erikd pushed a commit that referenced this issue Jun 1, 2020
Closes: #1063

@dcoutts The precision epsilon of the rational approximation was set to 1 in the parser.
Thus for most x in [0, 1] the best rational approximation of x in the interval [x - 1, x + 1] is 0/1.

This is fixed by setting epsilon equal to 0 and thus enforcing a machine precision rational approximation.
erikd pushed a commit that referenced this issue Jun 1, 2020
Closes: #1063

@dcoutts The precision epsilon of the rational approximation was set to 1 in the parser.
Thus for most x in [0, 1] the best rational approximation of x in the interval [x - 1, x + 1] is 0/1.

This is fixed by setting epsilon equal to 0 and thus enforcing a machine precision rational approximation.
@erikd erikd mentioned this issue Jun 1, 2020
iohk-bors bot added a commit that referenced this issue Jun 1, 2020
1110: Pool margin fix r=Jimbo4350 a=erikd

Closes: #1063

Relevant issue: IntersectMBO/cardano-ledger#1508

Co-authored-by: onyxstakepool <onyxstakepool@gmail.com>
@iohk-bors iohk-bors bot closed this as completed in f17b040 Jun 1, 2020
newhoggy pushed a commit to IntersectMBO/cardano-api that referenced this issue May 23, 2023
Closes: IntersectMBO/cardano-node#1063

@dcoutts The precision epsilon of the rational approximation was set to 1 in the parser.
Thus for most x in [0, 1] the best rational approximation of x in the interval [x - 1, x + 1] is 0/1.

This is fixed by setting epsilon equal to 0 and thus enforcing a machine precision rational approximation.
newhoggy pushed a commit to IntersectMBO/cardano-cli that referenced this issue May 24, 2023
Closes: IntersectMBO/cardano-node#1063

@dcoutts The precision epsilon of the rational approximation was set to 1 in the parser.
Thus for most x in [0, 1] the best rational approximation of x in the interval [x - 1, x + 1] is 0/1.

This is fixed by setting epsilon equal to 0 and thus enforcing a machine precision rational approximation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Pioneer Issues related to the Pioneer F&F Testnet priority high issues/PRs that MUST be addressed. The release can't happen without this;
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants