-
Notifications
You must be signed in to change notification settings - Fork 156
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
Value encoding #1979
Value encoding #1979
Conversation
77d8c6e
to
ee7065b
Compare
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.
Just left comments since this is still marked as draft.
|
||
-- ======================================================== | ||
|
||
-- | Remove 0 assets from a map | ||
prune :: Map (PolicyID era) (Map AssetID Integer) |
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.
I guess this is perhaps a bit slower than the old method?
69516f9
to
d2d5a7a
Compare
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.
LGTM!
1f689bf
to
7360191
Compare
7360191
to
3b73ac7
Compare
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.
Looks pretty good to me, couple of minor comments only
fromCBOR, | ||
toCBOR, | ||
) | ||
import Cardano.Binary (Decoder, Encoding, FromCBOR, ToCBOR, TokenType (..), decodeInt64, decodeWord64, fromCBOR, peekTokenType, toCBOR) |
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.
Can we avoid such very long lines?
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.
Doesn't ormolu do something about this?
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.
Ormolu basically has two choices: one line, or split them. If you add a random line break somewhere in there, ormolu will then format the whole list. But it allows you to choose not to add any line breaks, as in this case
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.
I'll break it up
@@ -1 +1 @@ | |||
-c "nix-shell ../../../shell.nix --run \"cabal repl -f development shelley-spec-ledger-test\"" -o ghcid.txt | |||
-c "nix-shell ../../../shell.nix --run \"cabal repl -f development test:shelley-spec-ledger-test\"" -o ghcid.txt |
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.
Is this change intentional?
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.
probably not, I'll remove it
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.
Could you fix the PR description before merging? It would be very confusing if the current message ends up in the history. You could, for example, copy the commit message (also rename the PR to match the commit's title).
fromCBOR, | ||
toCBOR, | ||
) | ||
import Cardano.Binary (Decoder, Encoding, FromCBOR, ToCBOR, TokenType (..), decodeInt64, decodeWord64, fromCBOR, peekTokenType, toCBOR) |
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.
Doesn't ormolu do something about this?
let assume Nothing = error $ "illegal value in txout: " <> show vl | ||
assume (Just x) = x |
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.
Similar suggestion about fromMaybe
a9f6fef
to
bb55dfd
Compare
The Value type is used in both TxOuts and in the Mint field of the transaction body, but negative values are only allowed in the latter. The rules already enforce this, but now the serialization does too. Resolves: CAD-1667 and CAD-2148
bb55dfd
to
44bb3b2
Compare
Different serializations for Value
The Value type is used in both TxOuts and in the Mint field of the transaction body, but negative values are only allowed in the latter. The rules already enforce this, but now the serialization does too.
Resolves: CAD-1667 and CAD-2148