Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be359a7
commit 786d06c
Showing
4 changed files
with
56 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 31 additions & 3 deletions
34
ouroboros-consensus-cardano-tools/src/Cardano/Tools/CardanoLedgerStateConverter/Types.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,43 @@ | ||
{-# LANGUAGE GADTs #-} | ||
|
||
module Cardano.Tools.CardanoLedgerStateConverter.Types | ||
( SelectDB (..) | ||
( AnyShelleyEra (..) | ||
, SomeNewEpochState (..) | ||
, Config (..) | ||
) where | ||
|
||
import Cardano.Binary (ToCBOR (..)) | ||
import qualified Cardano.Ledger.Allegra as SL | ||
import qualified Cardano.Ledger.Alonzo as SL | ||
import qualified Cardano.Ledger.Babbage as SL | ||
import Cardano.Ledger.Crypto (StandardCrypto) | ||
import qualified Cardano.Ledger.Mary as SL | ||
import qualified Cardano.Ledger.Shelley as SL | ||
import qualified Cardano.Ledger.Shelley.API as SL | ||
import Ouroboros.Consensus.Storage.LedgerDB.OnDisk (DiskSnapshot) | ||
|
||
data AnyShelleyEra c era where | ||
ShelleyEra :: AnyShelleyEra c (SL.ShelleyEra c) | ||
AllegraEra :: AnyShelleyEra c (SL.AllegraEra c) | ||
MaryEra :: AnyShelleyEra c (SL.MaryEra c) | ||
AlonzoEra :: AnyShelleyEra c (SL.AlonzoEra c) | ||
BabbageEra :: AnyShelleyEra c (SL.BabbageEra c) | ||
|
||
data SomeNewEpochState where | ||
SomeNewEpochState :: | ||
!(AnyShelleyEra StandardCrypto era) | ||
-> !(SL.NewEpochState era) | ||
-> SomeNewEpochState | ||
|
||
instance ToCBOR SomeNewEpochState where | ||
toCBOR (SomeNewEpochState ShelleyEra nes) = toCBOR nes | ||
toCBOR (SomeNewEpochState AllegraEra nes) = toCBOR nes | ||
toCBOR (SomeNewEpochState MaryEra nes) = toCBOR nes | ||
toCBOR (SomeNewEpochState AlonzoEra nes) = toCBOR nes | ||
toCBOR (SomeNewEpochState BabbageEra nes) = toCBOR nes | ||
|
||
data SelectDB = SelectImmutableDB (Maybe DiskSnapshot) | ||
|
||
data Config = Config { | ||
dbDir :: FilePath | ||
, selectDB :: SelectDB | ||
, snapShot :: DiskSnapshot | ||
} |