Skip to content

Commit

Permalink
Add the Conway era
Browse files Browse the repository at this point in the history
- cardano-test: update golden tests for Conway.
- Bump maxMajorProtVer to Conway's version.
- Comment on why certain eras do not need genesis data.
- Remove instructions to update `ShelleyBasedEras` since this is no.
  longer defined. We have a `ShelleyBasedEra` symbol, but that refers to a
  type class.
- Refer to the PR that adds Conway in 'AddingAnEra.md'
- Update out of date haddock for 'ProtocolTransitionParamsShelleyBased'
  and add a FIXME that should be addressed before this PR is merged.
- Remove reference to non-existing data structure. I do not know if we should mention
  'ProtocolTransitionParamsShelleyBased' here instead.
- Update the `ProtocolCardano` type synonym
- Extend changelog with entry describing the Conway era addition
- Add a `PerEraAnalysis` for Conway to `db-analyser`.
  • Loading branch information
nfrisby authored and dnadales committed Feb 1, 2023
1 parent aca7875 commit 903bcc6
Show file tree
Hide file tree
Showing 349 changed files with 1,069 additions and 233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ library
, cardano-ledger-alonzo-test
, cardano-ledger-babbage
, cardano-ledger-babbage-test
, cardano-ledger-conway-test
, cardano-ledger-byron
, cardano-ledger-core
, cardano-ledger-shelley
Expand Down Expand Up @@ -105,6 +106,7 @@ test-suite test

, cardano-ledger-alonzo
, cardano-ledger-byron
, cardano-ledger-conway
, cardano-ledger-core
, cardano-ledger-shelley
, cardano-protocol-tpraos
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ eraExamples =
:* Shelley.examplesMary
:* Shelley.examplesAlonzo
:* Shelley.examplesBabbage
:* Shelley.examplesConway
:* Nil

-- | By using this function, we can't forget to update this test when adding a
Expand All @@ -89,6 +90,7 @@ combineEras = mconcat . hcollapse . hap eraInjections
:* fn (K . injExamples "Mary" (IS (IS (IS IZ))))
:* fn (K . injExamples "Alonzo" (IS (IS (IS (IS IZ)))))
:* fn (K . injExamples "Babbage" (IS (IS (IS (IS (IS IZ))))))
:* fn (K . injExamples "Conway" (IS (IS (IS (IS (IS (IS IZ)))))))
:* Nil

injExamples ::
Expand Down Expand Up @@ -163,6 +165,9 @@ alonzoEraParams = Shelley.shelleyEraParams Shelley.testShelleyGenesis
babbageEraParams :: History.EraParams
babbageEraParams = Shelley.shelleyEraParams Shelley.testShelleyGenesis

conwayEraParams :: History.EraParams
conwayEraParams = Shelley.shelleyEraParams Shelley.testShelleyGenesis

-- | We use 10, 20, 30, 40, ... as the transition epochs
shelleyTransitionEpoch :: EpochNo
shelleyTransitionEpoch = 10
Expand Down Expand Up @@ -205,6 +210,13 @@ babbageStartBound =
alonzoStartBound
50

conwayStartBound :: History.Bound
conwayStartBound =
History.mkUpperBound
alonzoEraParams
alonzoStartBound
60

exampleStartBounds :: Exactly (CardanoEras Crypto) History.Bound
exampleStartBounds = Exactly $
( K byronStartBound
Expand All @@ -213,6 +225,7 @@ exampleStartBounds = Exactly $
:* K maryStartBound
:* K alonzoStartBound
:* K babbageStartBound
:* K conwayStartBound
:* Nil
)

Expand All @@ -224,6 +237,7 @@ cardanoShape = History.Shape $ Exactly $
:* K maryEraParams
:* K alonzoEraParams
:* K babbageEraParams
:* K conwayEraParams
:* Nil
)

Expand Down Expand Up @@ -251,6 +265,7 @@ codecConfig =
Shelley.ShelleyCodecConfig
Shelley.ShelleyCodecConfig
Shelley.ShelleyCodecConfig
Shelley.ShelleyCodecConfig

ledgerStateByron ::
LedgerState ByronBlock
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ type ShelleyBasedHardForkConstraints proto1 era1 proto2 era2 =
, SL.TranslationError era2 SL.NewEpochState ~ Void
, SL.TranslationError era2 SL.ShelleyGenesis ~ Void

, SL.TranslationContext era1 ~ ()
, SL.AdditionalGenesisConfig era1 ~ ()
, SL.TranslationContext era1 ~ ()
, SL.AdditionalGenesisConfig era2 ~ SL.TranslationContext era2
-- At the moment, fix the protocols together
, EraCrypto era1 ~ EraCrypto era2
, PraosCrypto (EraCrypto era1)
Expand Down Expand Up @@ -265,7 +267,7 @@ protocolInfoShelleyBasedHardFork protocolParamsShelleyBased
protocolInfo1 =
protocolInfoTPraosShelleyBased
protocolParamsShelleyBased
() -- trivial translation context
((), ()) -- trivial additional Genesis config and translation context
protVer1
(TxLimits.mkOverrides TxLimits.noOverridesMeasure)

Expand Down Expand Up @@ -298,7 +300,7 @@ protocolInfoShelleyBasedHardFork protocolParamsShelleyBased
, shelleyBasedInitialNonce
, shelleyBasedLeaderCredentials
}
transCtxt2
(transCtxt2, transCtxt2)
protVer2
(TxLimits.mkOverrides TxLimits.noOverridesMeasure)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ toCardanoCodecConfig codecConfigByron =
ShelleyCodecConfig
ShelleyCodecConfig
ShelleyCodecConfig
ShelleyCodecConfig

{------------------------------------------------------------------------------
Byron to Cardano
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ instance CardanoHardForkConstraints c
CardanoNodeToNodeVersion4 -> "CardanoNodeToNodeVersion4"
CardanoNodeToNodeVersion5 -> "CardanoNodeToNodeVersion5"
CardanoNodeToNodeVersion6 -> "CardanoNodeToNodeVersion6"
CardanoNodeToNodeVersion7 -> "CardanoNodeToNodeVersion7"
_ -> error $ "Unknown version: " <> show v

instance CardanoHardForkConstraints c
Expand All @@ -49,4 +50,5 @@ instance CardanoHardForkConstraints c
CardanoNodeToClientVersion8 -> "CardanoNodeToClientVersion8"
CardanoNodeToClientVersion9 -> "CardanoNodeToClientVersion9"
CardanoNodeToClientVersion10 -> "CardanoNodeToClientVersion10"
CardanoNodeToClientVersion11 -> "CardanoNodeToClientVersion11"
_ -> error $ "Unknown version: " <> show blockVersion
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,21 @@ testCodecCfg =
ShelleyCodecConfig
ShelleyCodecConfig
ShelleyCodecConfig
ShelleyCodecConfig

dictNestedHdr
:: forall a.
NestedCtxt_ (CardanoBlock MockCryptoCompatByron) Header a
-> Dict (Eq a, Show a)
dictNestedHdr = \case
NCZ (CtxtByronBoundary {}) -> Dict
NCZ (CtxtByronRegular {}) -> Dict
NCS (NCZ CtxtShelley) -> Dict
NCS (NCS (NCZ CtxtShelley)) -> Dict
NCS (NCS (NCS (NCZ CtxtShelley))) -> Dict
NCS (NCS (NCS (NCS (NCZ CtxtShelley)))) -> Dict
NCS (NCS (NCS (NCS (NCS (NCZ CtxtShelley))))) -> Dict
NCZ (CtxtByronBoundary {}) -> Dict
NCZ (CtxtByronRegular {}) -> Dict
NCS (NCZ CtxtShelley) -> Dict
NCS (NCS (NCZ CtxtShelley)) -> Dict
NCS (NCS (NCS (NCZ CtxtShelley))) -> Dict
NCS (NCS (NCS (NCS (NCZ CtxtShelley)))) -> Dict
NCS (NCS (NCS (NCS (NCS (NCZ CtxtShelley))))) -> Dict
NCS (NCS (NCS (NCS (NCS (NCS (NCZ CtxtShelley)))))) -> Dict

{-------------------------------------------------------------------------------
BinaryBlockInfo
Expand Down
26 changes: 22 additions & 4 deletions ouroboros-consensus-cardano-test/test/Test/ThreadNet/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import Ouroboros.Consensus.Byron.Ledger.Conversions
import Ouroboros.Consensus.Byron.Node

import qualified Cardano.Ledger.BaseTypes as SL (ActiveSlotCoeff)
import qualified Cardano.Ledger.Conway.Genesis as SL
import qualified Cardano.Ledger.Shelley.API as SL

import Ouroboros.Consensus.Shelley.Ledger.SupportsProtocol ()
Expand Down Expand Up @@ -77,7 +78,7 @@ import Test.Util.TestEnv

import Ouroboros.Consensus.Protocol.Praos.Translate ()
import Ouroboros.Consensus.Shelley.Node.Praos
(ProtocolParamsBabbage (..))
(ProtocolParamsBabbage (..), ProtocolParamsConway (..))
import Test.ThreadNet.Infra.TwoEras

-- | Use 'MockCryptoCompatByron' so that bootstrap addresses and
Expand Down Expand Up @@ -525,8 +526,12 @@ mkProtocolCardanoAndHardForkTxs
, alonzoMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
}
ProtocolParamsBabbage {
babbageProtVer = SL.ProtVer babbageMajorVersion 0
, babbageMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
babbageProtVer = SL.ProtVer babbageMajorVersion 0
, babbageMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
}
ProtocolParamsConway {
conwayProtVer = SL.ProtVer conwayMajorVersion 0
, conwayMaxTxCapacityOverrides = TxLimits.mkOverrides TxLimits.noOverridesMeasure
}
protocolParamsByronShelley
ProtocolTransitionParamsShelleyBased {
Expand All @@ -549,6 +554,14 @@ mkProtocolCardanoAndHardForkTxs
, transitionTrigger =
TriggerHardForkAtVersion babbageMajorVersion
}
ProtocolTransitionParamsShelleyBased {
transitionTranslationContext =
-- Note that this is effectively a no-op, which is fine for
-- testing, at least for now.
SL.ConwayGenesis $ SL.GenDelegs $ sgGenDelegs genesisShelley
, transitionTrigger =
TriggerHardForkAtVersion conwayMajorVersion
}

-- Byron

Expand Down Expand Up @@ -604,11 +617,16 @@ maryMajorVersion = allegraMajorVersion + 1
alonzoMajorVersion :: Num a => a
alonzoMajorVersion = maryMajorVersion + 1

-- | The major protocol version of babbage in this test
-- | The major protocol version of Babbage in this test
--
babbageMajorVersion :: Num a => a
babbageMajorVersion = alonzoMajorVersion + 1

-- | The major protocol version of Conway in this test
--
conwayMajorVersion :: Num a => a
conwayMajorVersion = babbageMajorVersion + 1

-- | The initial minor protocol version of Byron in this test
--
-- See 'byronMajorVersion'
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�X �6�54I�F���?����O{[�h�V
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�X ��3�?�G�Ca�\�ո��1�%E�g#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�X �|�a��!��bI�©���I&pZ\K���pM�
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�X �|�a��!��bI�©���I&pZ\K���pM�
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�X �Ճ(x��.��x�_G��F��ߖ} Ԉh+ޢ
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�X ���np��+�t���3N��Ue�<Ҷ���=�
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��H<HEADER>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��H<HEADER>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��H<HEADER>
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��H<HEADER>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��H<HEADER>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��H<HEADER>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
�O<CARDANO_BLOCK>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HardForkEncoderDisabledEra (SingleEraInfo {singleEraName = "Conway"})
Loading

0 comments on commit 903bcc6

Please sign in to comment.