-
Notifications
You must be signed in to change notification settings - Fork 158
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
Mismatch for Conway predicate failures #4666
base: master
Are you sure you want to change the base?
Conversation
87dba8f
to
a6572dd
Compare
7e89bac
to
99cee0e
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.
Very nice improvement! Your handling of the protocol encoding variations is neat, too.
My suggestions are mostly cosmetic.
However, there's a more substantial one at the end. It doesn't affect the functionality, but it does affect the readability.
I've also suggested a few additional places where Mismatch
could be used.
99cee0e
to
0ff6cfb
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.
All my comments in BBODY rule module apply to all other rules affected by this PR.
0437261
to
3f8dd45
Compare
3f8dd45
to
c47d53d
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.
OK I only commented on the Coders parts.
The extra constraint should not be there. We should try hrd to get rid of it.
libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Coders.hs
Outdated
Show resolved
Hide resolved
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.
This is looking great!
A few more simplifications and improvements and it will ready to go
libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Coders.hs
Outdated
Show resolved
Hide resolved
libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Coders.hs
Outdated
Show resolved
Hide resolved
libs/cardano-ledger-binary/src/Cardano/Ledger/Binary/Decoding/Coders.hs
Outdated
Show resolved
Hide resolved
34b1182
to
e8ec767
Compare
@@ -1,6 +1,6 @@ | |||
cabal-version: 3.0 | |||
name: cardano-ledger-binary | |||
version: 1.4.0.0 | |||
version: 1.4.1.0 |
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 think this requires 1.5.0.0
, because it's a breaking change .
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.
The change won't break any client usage of the library, because it just introduces a new constructor. So a minor
bump should be enough I thought.
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.
version: 1.4.1.0 | |
version: 1.5.0.0 |
@teodanciu is right! This is a major breaking change. This is not explicitly listed in PVP, but it is widely considered to be a breaking change in the Haskell community. See some discussions here and comment by Phadej: "It adds constructors to LicenseId and LicenseListVersion, Language.Haskell.Extension.Extension. These are breaking changes."
Here is my reason depicted with an example why I consider such change to be a breaking change:
Imagine package A-1.0.0
defines Foo
:
data Foo = Foo | Bar deriving Read
Package B-1.0.0
depends on A >= 1.0
and provides a function:
readFooIxMaybe :: String -> Maybe Int
readFooIxMaybe str = do
foo <- readMaybe str
pure $ case foo of
Foo -> 1
Bar -> 2
If you add a constructor to Foo
and only bump a minor version in package A-1.0.1
:
data Foo = Foo | Bar | Baz deriving Read
Then package B-1.0.0
will have the readFooIxMaybe
function turn from a total to a partial function.
44395aa
to
1e058b9
Compare
1e058b9
to
cb9eed2
Compare
Also, add {Enc,Dec}CBORGroup instances for Mismatch
Rules: - BBODY - GOV - GOVCERT - LEDGER - UTXO - UTXOW
cb9eed2
to
0d410a1
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.
There is one change that is still necessary that I overlooked and @teodanciu caught. It needs to be fixed. Otherwise it is ready to be merged.
@@ -1,8 +1,10 @@ | |||
# Version history for `cardano-ledger-binary` | |||
|
|||
## 1.4.0.1 | |||
## 1.4.1.0 |
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.
Sorry, I did not catch it earlier, but adding a new constructor to a sum type is commonly considered a breaking change.
## 1.4.1.0 | |
## 1.5.0.0 |
@@ -1,6 +1,6 @@ | |||
cabal-version: 3.0 | |||
name: cardano-ledger-binary | |||
version: 1.4.0.0 | |||
version: 1.4.1.0 |
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.
version: 1.4.1.0 | |
version: 1.5.0.0 |
@teodanciu is right! This is a major breaking change. This is not explicitly listed in PVP, but it is widely considered to be a breaking change in the Haskell community. See some discussions here and comment by Phadej: "It adds constructors to LicenseId and LicenseListVersion, Language.Haskell.Extension.Extension. These are breaking changes."
Here is my reason depicted with an example why I consider such change to be a breaking change:
Imagine package A-1.0.0
defines Foo
:
data Foo = Foo | Bar deriving Read
Package B-1.0.0
depends on A >= 1.0
and provides a function:
readFooIxMaybe :: String -> Maybe Int
readFooIxMaybe str = do
foo <- readMaybe str
pure $ case foo of
Foo -> 1
Bar -> 2
If you add a constructor to Foo
and only bump a minor version in package A-1.0.1
:
data Foo = Foo | Bar | Baz deriving Read
Then package B-1.0.0
will have the readFooIxMaybe
function turn from a total to a partial function.
* | ||
* Extend `Coders` to accommodate `{Enc|Dec}CBORGroup`. #4666 | ||
* Add `ToGroup` to `Encode` | ||
* Add `FromGroup` to `Decode` | ||
|
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.
* Add `{Enc|Dec}CBORGroup` instance for `(a, b)` | |
Description
This is the second (Conway) part of #4619.
Checklist
CHANGELOG.md
for the affected packages.New section is never added with the code changes. (See RELEASING.md)
.cabal
andCHANGELOG.md
files according to theversioning process.
.cabal
files for all affected packages are updated.If you change the bounds in a cabal file, that package itself must have a version increase. (See RELEASING.md)
fourmolu
(usescripts/fourmolize.sh
)scripts/cabal-format.sh
)hie.yaml
has been updated (usescripts/gen-hie.sh
)