-
Notifications
You must be signed in to change notification settings - Fork 86
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
ThreadNet: add ShelleyAllegra tests #2641
Conversation
c2c49f7
to
d41f2af
Compare
d41f2af
to
b8f7b30
Compare
This is timing out on the mac-mini build: |
b8f7b30
to
7537ad8
Compare
I'll admit, that's the first time I did the math. So if the variance is too high, maybe the total time is likely to be more than double the average... especially if the mac-mini build is relatively slow. I'll have some data after this CI build, and then we can consider disabling this test outside of the nightly. |
7537ad8
to
5b0fb8b
Compare
My latest push here disables random transactions in Remaining item is to fix the translation of the ledger view forecast. |
I'll take over this PR so that @nfrisby can focus on the ThreadNet rewrite.
I'll rebase this tomorrow, not that #2681 has been merged. That PR disables the Shelley transaction generator, which this PR also does.
The master branch includes #2661, which provides a correct translation function which I'll use.
Agreed. As of #2666, we have the Allegra and Mary eras. So I'm thinking of changing At the moment, there is no real difference between Shelley->Shelley, Shelley->Allegra, or Allegra->Mary (Allegra and Mary are currently identical to Shelley). That will soon change with #2679, after which I'll also introduce I would still like to have at least one test running all the hard forks of |
Yep, that's what I had in mind 👍 Do note: such a test will require a lot of slots; those epochs are long. Also, the current ThreadNet tests cannot easily (at all?) express the necessary transactions for transitioning from eg the second era to the third. At the moment, the "crucial tx" infra we use for these can only (easily?) express the transactions necessary for leaving the first era. (This is compounded by needing to know a valid UTxO for use as an input.) Fixing this is something we're keeping in mind for the ThreadNet rewrite. Thanks for taking this over. |
FYI, I have been working on this in the background. I have refactored some things to make the two-era infrastructure generic and reusable with a minimum of boilerplate (e.g., #2687). I am currently distracted by some other ledger integration related things, but will soon get back to this. |
a83db56
to
52c362e
Compare
52c362e
to
d26ca87
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.
Update:
- Rebased
- Removed some unused code from
TwoEras
that was copied fromCardano
, e.g.,TestSetup
. - Changed the names in
TwoEras
to no longer assume Byron and Shelley. See the TODOs. - Generalised the
ShelleyShelley
infra toShelleyBasedHardFork
. This generalisation ironically does not permitShelleyShelley
as it wants a translation between the two eras. - Changed the
ShelleyShelley
test toShelleyAllegra
, as this is the next hard fork, so it's important to test it. (Note that we will extendCardano
with Allegra and Mary soon).
I have left some comments on the TODOs that still need addressing.
-- sufficiently strict upper bound to preclude a Chain Growth violation, | ||
-- since Chain Growth isn't technically violated until @2k@ slots have | ||
-- passed (it's also relevant that the net forges at full round-robin | ||
-- speed until the partition starts). (TODO does that cover Shelley too?) |
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.
TODO This function will be used by Cardano
(first era = Byron) and ShelleyAllegra
(first era = Shelley), but currently assumes Byron is the first era.
(Note that Cardano
will have be generalised to 3 and 4 eras soon.)
, (1, Just $ 4 * k + 1) | ||
, (1, Just $ 4 * k + 1 + quorum) | ||
, (20, assert (numFirstEraEpochs == (1 :: Int)) $ | ||
Just $ byronEpochSize (SecurityParam k)) |
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.
TODO Byron-specific
ouroboros-consensus-cardano-test/test/Test/ThreadNet/ShelleyAllegra.hs
Outdated
Show resolved
Hide resolved
--- TODO this comment and code are wrong | ||
|
||
BoolProps.requiredIf $ | ||
-- The active slots in the first two Shelley epochs are all overlay | ||
-- slots, so the first Shelley block will arise from one of those. | ||
not $ Set.null overlaySlots |
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.
TODO
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.
@nfrisby I don't understand this. Should this be fixed before merging? I'm inclined to leave it as-is, as the rewrite is coming.
55d949a
to
554773a
Compare
-- Choose @NP WrapTxGenExtra xs@ for the instance of the 'TxGenExtra' type | ||
-- family, where @xs@ matches the concrete instantiation. | ||
testGenTxsHfc :: | ||
forall xs. (All TxGen xs, CanHardFork xs) |
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 takes instances and produces a function, it should takes functions and produce a function.
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.
That would require taking an NP of testGenTxs
, which is annoying. Leave it.
ouroboros-consensus/src/Ouroboros/Consensus/HardFork/Combinator/Binary.hs
Outdated
Show resolved
Hide resolved
pattern ShelleyBasedHardForkNodeToNodeVersion1 = | ||
HardForkNodeToNodeEnabled | ||
HardForkSpecificNodeToNodeVersion1 | ||
( EraNodeToNodeEnabled ShelleyNodeToNodeVersion1 |
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.
Use maxBound
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.
Uggh, can't use maxBound
here, this also has to be a pattern of course.
ouroboros-consensus-cardano-test/src/Test/ThreadNet/Infra/ShelleyBasedHardFork.hs
Outdated
Show resolved
Hide resolved
ouroboros-consensus-cardano-test/src/Test/ThreadNet/Infra/ShelleyBasedHardFork.hs
Outdated
Show resolved
Hide resolved
import Test.ThreadNet.TxGen (TxGen (..)) | ||
|
||
-- | Dummy generator until CAD-2119 is done, i.e., the transaction generator in | ||
-- the ledger has been generalised over the eras. |
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.
Check whether this has been done since.
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.
IntersectMBO/cardano-ledger#1997 has been merged, but there isn't yet an instance for Allegra/Mary as far as I can see. IntersectMBO/cardano-ledger#2000 is open.
--- TODO this comment and code are wrong | ||
|
||
BoolProps.requiredIf $ | ||
-- The active slots in the first two Shelley epochs are all overlay | ||
-- slots, so the first Shelley block will arise from one of those. | ||
not $ Set.null overlaySlots |
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.
@nfrisby I don't understand this. Should this be fixed before merging? I'm inclined to leave it as-is, as the rewrite is coming.
We will be adding `Binary` shortly.
`protocolInfoShelleyBased` can be used for each Shelley-based epoch. This can in the future be used for Allegra, Mary, ..., too. Reimplement the existing `protocolInfoShelley` in terms of it.
554773a
to
1e077c4
Compare
1e077c4
to
55eb8b0
Compare
Since the ThreadNet tests pass (including a nightly) with some of the Byron-specific bits in place, I'm going to merge it as-is. We can improve them later. |
bors merge |
2641: ThreadNet: add ShelleyAllegra tests r=mrBliss a=nfrisby Fixes #2633. This follows up #2627 by adding tests that exercise the ability to hard from from a Shelley-based era to the next Shelley-based era (in this case, Shelley to Allegra). This PR introduces the `TwoEras.hs` infrastructure. For every era we have, we should have a two-era test that has a primary interest of whether or not a proposal in that era can successfully induce a hard fork, especially in the presence of a short network partition. I suggest, as part of Issue #2472, we should continue to emphasize these "Will it fork?" tests. As of this PR, `Cardano.hs` tests that we can hard fork out of Byron and `ShelleyAllegra.hs` tests that we can hard fork out of `Shelley`. At the moment, both have two eras, and so they can share the infrastructure that was factored out into `TwoEras.hs` Eventually `Cardano.hs` will have 3-4 eras. At that time, I propose we introduce a `Byron______.hs` module that specifically tests leaving Byron. Maybe to Byron again, or still to Shelley, etc. To summarize: we should have a separate test dedicated to testing each adjacent pair of eras on mainnet and one more that tests a hard fork from the last mainnet era to another copy of itself. Edit: Edsko and I have something along these lines in mind while working on Issue 2472, the rewrite. But we hope to have it be a tidy consolidated thing instead of as explicit as the above proposal. Co-authored-by: Thomas Winant <thomas@well-typed.com> Co-authored-by: Nicolas Frisby <nick.frisby@iohk.io>
Timed out. |
bors merge |
2641: ThreadNet: add ShelleyAllegra tests r=mrBliss a=nfrisby Fixes #2633. This follows up #2627 by adding tests that exercise the ability to hard from from a Shelley-based era to the next Shelley-based era (in this case, Shelley to Allegra). This PR introduces the `TwoEras.hs` infrastructure. For every era we have, we should have a two-era test that has a primary interest of whether or not a proposal in that era can successfully induce a hard fork, especially in the presence of a short network partition. I suggest, as part of Issue #2472, we should continue to emphasize these "Will it fork?" tests. As of this PR, `Cardano.hs` tests that we can hard fork out of Byron and `ShelleyAllegra.hs` tests that we can hard fork out of `Shelley`. At the moment, both have two eras, and so they can share the infrastructure that was factored out into `TwoEras.hs` Eventually `Cardano.hs` will have 3-4 eras. At that time, I propose we introduce a `Byron______.hs` module that specifically tests leaving Byron. Maybe to Byron again, or still to Shelley, etc. To summarize: we should have a separate test dedicated to testing each adjacent pair of eras on mainnet and one more that tests a hard fork from the last mainnet era to another copy of itself. Edit: Edsko and I have something along these lines in mind while working on Issue 2472, the rewrite. But we hope to have it be a tidy consolidated thing instead of as explicit as the above proposal. Co-authored-by: Thomas Winant <thomas@well-typed.com> Co-authored-by: Nicolas Frisby <nick.frisby@iohk.io>
bors ping |
pong |
bors merge |
Already running a review |
Bors' job in Hydra finished 1h ago: https://hydra.iohk.io/eval/981006 🙄 |
Timed out. |
bors merge |
Build succeeded: |
Fixes #2633.
This follows up #2627 by adding tests that exercise the ability to hard from from a Shelley-based era to the next Shelley-based era (in this case, Shelley to Allegra).
This PR introduces the
TwoEras.hs
infrastructure. For every era we have, we should have a two-era test that has a primary interest of whether or not a proposal in that era can successfully induce a hard fork, especially in the presence of a short network partition. I suggest, as part of Issue IntersectMBO/ouroboros-consensus#651, we should continue to emphasize these "Will it fork?" tests.As of this PR,
Cardano.hs
tests that we can hard fork out of Byron andShelleyAllegra.hs
tests that we can hard fork out ofShelley
. At the moment, both have two eras, and so they can share the infrastructure that was factored out intoTwoEras.hs
Eventually
Cardano.hs
will have 3-4 eras. At that time, I propose we introduce aByron______.hs
module that specifically tests leaving Byron. Maybe to Byron again, or still to Shelley, etc. To summarize: we should have a separate test dedicated to testing each adjacent pair of eras on mainnet and one more that tests a hard fork from the last mainnet era to another copy of itself.Edit: Edsko and I have something along these lines in mind while working on Issue 2472, the rewrite. But we hope to have it be a tidy consolidated thing instead of as explicit as the above proposal.