-
Notifications
You must be signed in to change notification settings - Fork 722
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
Replace roundtripCBOR with trippingCbor #5069
Replace roundtripCBOR with trippingCbor #5069
Conversation
2357ebb
to
0ef2e8c
Compare
0ef2e8c
to
e8b50c5
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.
👍 Nice
6830f1d
to
9384c16
Compare
-> (TxInsCollateral era, [Fund]) | ||
-> TxFee era | ||
-> TxMetadataInEra era | ||
-> TxGenerator era | ||
genTx protocolParameters (collateral, collFunds) fee metadata inFunds outputs | ||
genTx _era protocolParameters (collateral, collFunds) fee metadata inFunds outputs |
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 I ask what the motivation for the change is? I don't find any in the scope of this PR (as in: it builds and behaves fine without that change)?
If it is some kind of future-proofing, why not use cardanoEra @era
in the body of genTx
without changing call sites?
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.
Please see this comment:
By passing in the era as an argument, the caller can easily specify which era they want to run a property test for.
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.
Yes of course, that makes total sense then.
Thank you @newhoggy
… use more of in tests in the future and the function doesn't reduce the code by that much.
…es not yet behave era dependently
9384c16
to
2be0d46
Compare
roundtripCBOR
was used to reduce the amount of code for round trip tests, but it does not work well with GADTs.We expect to use GADTs more in these tests in order to make them era independent.
Work-arounds for
roundtripCBOR
have been used to make it possible to encode tests for multiple eras. These include:[TestTree]
instead of aProperty
This PR introduces
trippingCbor
which captures the tripping part of the property test.It turns out that writing out the property test directly rather than generating the property gives us the flexibility to use GADTs and thus be able to encode era independent property tests, which allows us to eliminate per era duplication and avoid generating test groups.