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

Update ledger one commit and resolve golden test failure #1899

Merged
merged 1 commit into from
Apr 3, 2020

Conversation

dcoutts
Copy link
Contributor

@dcoutts dcoutts commented Apr 3, 2020

The ledger patch 512c26a66a6a63278846646b81bf8eadcd4ae99c introduced a change in the representation of one field in TxSizeLinear, to resolve an important bug with fee calculations.

It did not change the CBOR representation of the TxSizeLinear, but it did change an example lovelace-per-byte fee value from (44 :: Lovelace) to (43.946 :: Rational).

This example value is in the byron consensus golden tests so this of course changes the serialised reference values in the tests.

It is slightly hard to see the change clearly because the TxSizeLinear gets double-serialised, so the change is

-"\130\ESC\NUL\NUL\141QuOR\NUL\ESC\NUL\NUL\NUL\n>\154\184\NUL"
+"\130\ESC\NUL\NUL\141QuOR\NUL\ESC\NUL\NUL\NUL\n;b\190\128"

The difference without the double-serialisation is more instructive:

-[TkListLen 2,TkInt 155381000000000,TkInt 44000000000]
+[TkListLen 2,TkInt 155381000000000,TkInt 43946000000]

This is then completely obvious given the change in the example from 44 to 43.946.

Also added a specific golden test for the TxSizeLinear to make this all a bit clearer, to explain the magic bytes.

Comment on lines 3 to 4
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DataKinds #-}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you sort this list? Otherwise, stylish-haskell will reorder it the next time we touch this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😞

The ledger patch 512c26a66a6a63278846646b81bf8eadcd4ae99c intoduced a
change in the representation of one field in TxSizeLinear, to resolve an
important bug with fee calculations.

It did not change the CBOR representation of the TxSizeLinear, but it
did change an example lovelace-per-byte fee value from (44 :: Lovelace)
to (43.946 :: Rational).

This example value is in the byron consensus golden tests so this of
course changes the serialised reference values in the tests.

It is slightly hard to see the change clearly because the TxSizeLinear
gets double-serialised, so the change is

-"\130\ESC\NUL\NUL\141QuOR\NUL\ESC\NUL\NUL\NUL\n>\154\184\NUL"
+"\130\ESC\NUL\NUL\141QuOR\NUL\ESC\NUL\NUL\NUL\n;b\190\128"

The difference without the double-serialisation is more instructive:

-[TkListLen 2,TkInt 155381000000000,TkInt 44000000000]
+[TkListLen 2,TkInt 155381000000000,TkInt 43946000000]

This is then completely obvious given the change in the example from 44
to 43.946.

Also added a specific golden test for the TxSizeLinear to make this all
a bit clearer, to explain the magic bytes.
@dcoutts dcoutts force-pushed the dcoutts/ledger-golden-fee-fix branch from 08e1262 to fa62d29 Compare April 3, 2020 16:51
@dcoutts
Copy link
Contributor Author

dcoutts commented Apr 3, 2020

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Apr 3, 2020

@iohk-bors iohk-bors bot merged commit 4e3304d into master Apr 3, 2020
@iohk-bors iohk-bors bot deleted the dcoutts/ledger-golden-fee-fix branch April 3, 2020 19:18
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.

4 participants