-
Notifications
You must be signed in to change notification settings - Fork 87
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
Test that UTxO tables are updated correctly on era transitions #4073
Test that UTxO tables are updated correctly on era transitions #4073
Conversation
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 good so far.
ouroboros-consensus-byron-test/src/Test/Consensus/Byron/Generators.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Show resolved
Hide resolved
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Show resolved
Hide resolved
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Outdated
Show resolved
Hide resolved
(fixedEpochInfo (sgEpochLength shelleyGenesis) tpraosSlotLength) | ||
(MaxMajorProtVer 1000) | ||
|
||
shelleyGenesis :: ShelleyGenesis era |
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.
If we use a fixed Shelley genesis we should justify why. I think in this case the justification might be that we are interested in the initial UTxO set, which is not affected by the genesis config. But we need to confirm this.
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Outdated
Show resolved
Hide resolved
aa80b45
to
12effd8
Compare
2f08815
to
280e92c
Compare
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Show resolved
Hide resolved
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Outdated
Show resolved
Hide resolved
tests = testGroup "UpdateTablesOnEraTransition" $ toTestTrees predicates tls | ||
where | ||
tls = translateLedgerState hardForkEraTranslation | ||
predicates :: InPairs TranslationPredicate (CardanoEras Crypto) |
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.
Why not define a [TestTree]
directly? Is toTestTrees
necessary?
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 suspect this can be indeed reshaped to just define a [TestTree]
and avoid having to re-zip the InPairs
s. Was there a specific reason to not do so?
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.
Well, I couldn't do 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.
To define the properties I need to have access to the appropriate TranslateEra x y
values. I chose the direction of zipping the predicates with what is loosely, InPairs TranslateEra (CardanoEras c)
.
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.
What do you guys think about b762d98
@bartfrenk feel free to discard this commit and force push if you prefer to keep toTestTree
.
If the commit above makes sense, we should probably address this:
-- | TODO: we should simply expose 'translateLedgerStateByronToShelleyWrapper'
-- and other translations in ' Ouroboros.Consensus.Cardano.CanHardFork'.
If we discard this commit we should remove the "boom" string and use a more appropriate label.
, Show (LedgerConfig dest) | ||
, Show (LedgerState src EmptyMK)) => Show (TestSetup src dest) | ||
|
||
-- todo: Useful to merge some of these instances? |
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 don't see how we could merge the Byron to Shelley instances. I'm not sure about the others. Do you know what prevents us from defining a:
instance Arbitrary (TestSetup (ShelleyBlock p era0) (ShelleyBlock p era1))
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.
Even further
instance Arbitrary (TestSetup (ShelleyBlock p (PreviousEra era)) (ShelleyBlock p era))
Although the proto
s don't need to be equal...
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Show resolved
Hide resolved
I forgot to add these remaining tasks:
|
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 good overall! I would do some cosmetic changes as proposed but overall it looks nice
Constraints | ||
-------------------------------------------------------------------------------} | ||
|
||
type family AllPairs |
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 always have trouble deciding if these should be classes or closed type families...
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 adapted from Maguire's Thinking with types. I can kind-of see how to do it with classes, but I like the terseness of this definition, and I think, but do not know, the class-one will be more convoluted.
ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Util/InPairs.hs
Outdated
Show resolved
Hide resolved
, Show (LedgerConfig dest) | ||
, Show (LedgerState src EmptyMK)) => Show (TestSetup src dest) | ||
|
||
-- todo: Useful to merge some of these instances? |
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.
Even further
instance Arbitrary (TestSetup (ShelleyBlock p (PreviousEra era)) (ShelleyBlock p era))
Although the proto
s don't need to be equal...
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Outdated
Show resolved
Hide resolved
tests = testGroup "UpdateTablesOnEraTransition" $ toTestTrees predicates tls | ||
where | ||
tls = translateLedgerState hardForkEraTranslation | ||
predicates :: InPairs TranslationPredicate (CardanoEras Crypto) |
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 suspect this can be indeed reshaped to just define a [TestTree]
and avoid having to re-zip the InPairs
s. Was there a specific reason to not do so?
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-cardano-test/test/Test/Consensus/Cardano/Translation.hs
Show resolved
Hide resolved
bors r+ |
Timed out. |
bors r+ |
Timed out. |
We should also test with empty UTxO, shouldn't we?
It seems we aren't at the moment. |
Co-authored-by: Damian Nadales <damian.only@gmail.com>
Co-authored-by: Damian Nadales <damian.only@gmail.com>
Co-authored-by: Damian Nadales <damian.only@gmail.com>
Co-authored-by: Damian Nadales <damian.only@gmail.com>
Description
Test that UTxO tables are computed correctly on era transitions, for all era transitions.
Closes #4043.
Checklist